28743095-SAS-Interview-Questions

28743095-SAS-Interview-Questions - SAS Interview...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Very Basic:· What SAS statements would you code to read an external raw data file to a DATA step? INFILE statement. · How do you read in the variables that you need? Using Input statement with the column pointers like @5/12-17 etc. · Are you familiar with special input delimiters? How are they used? DLM and DSD are the delimiters that I’ve used. They should be included in the infile statement. Comma separated values files or CSV files are a common type of file that can be used to read with the DSD option. DSD option treats two delimiters in a row as MISSING value. DSD also ignores the delimiters enclosed in quotation marks. · If reading a variable length file with fixed input, how would you prevent SAS from reading the next record if the last variable didn't have a value? By using the option MISSOVER in the infile statement.If the input of some data lines are shorter than others then we use TRUNCOVER option in the infile statement. · What is the difference between an informat and a format? Name three informats or formats . Informats read the data. Format is to write the data. Informats: comma. dollar. date. Formats can be same as informatsInformats: MMDDYYw. DATEw. TIMEw. , PERCENTw,Formats: WORDIATE18., weekdatew. · Name and describe three SAS functions that you have used, if any? LENGTH: returns the length of an argument not counting the trailing blanks.(missing values have a length of 1)Ex: a=’my cat’;x=LENGTH(a); Result: x=6… SUBSTR: SUBSTR( arg ,position,n) extracts a substring from an argument starting at ‘position’ for ‘n’ characters or until end if no ‘n’. Ex: A=’(916)734-6241’;X=SUBSTR(a,2,3); RESULT: x=’916’ TRIM: removes trailing blanks from character expression. Ex: a=’my ‘; b=’cat’;X= TRIM(a)(b); RESULT: x=’mycat’. SUM: sum of non missing values.Ex: x=Sum(3,5,1); result: x=9.0 INT: Returns the integer portion of the argument. · How would you code the criteria to restrict the output to be produced?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

28743095-SAS-Interview-Questions - SAS Interview...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online