23376754-SAS-Interview-Questions-and-Answers-1

23376754-SAS-Interview-Questions-and-Answers-1 - What SAS...

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

View Full Document Right Arrow Icon
What SAS statements would you code to read an external raw data file to a DATA step? We use SAS statements – FILENAME – to specify the location of the file INFILE - Identifies an external file to read with an INPUT statement INPUT – to specify the variables that the data is identified with. How do you read in the variables that you need? Using Input statement with column /line pointers, informats and length specifiers. Are you familiar with special input delimiters? How are they used? DLM, DSD are the special input delimiters… DELIMITER= delimiter(s) specifies an alternate delimiter (other than a blank) to be used for LIST input DSD (delimiter-sensitive data) specifies that when data values are enclosed in quotation marks, delimiters within the value be treated as character data. The DSD option changes how SAS treats delimiters when you use LIST input and sets the default delimiter to a comma. When you specify DSD, SAS treats two consecutive delimiters as a missing value and removes quotation marks from character values http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000146932.htm#a000177189 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? Options MISSOVER and TRUNCOVER options. . MISSOVER
Background image of page 1

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

View Full DocumentRight Arrow Icon
prevents an INPUT statement from reading a new input data record if it does not find values in the current input line for all the variables in the statement. When an INPUT statement reaches the end of the current input data record, variables without any values assigned are set to missing. TRUNCOVER overrides the default behavior of the INPUT statement when an input data record is shorter than the INPUT statement expects. By default, the INPUT statement automatically reads the next input data record. TRUNCOVER enables you to read variable-length records when some records are shorter than the INPUT statement expects. Variables without any values assigned are set to missing. http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000146932.htm#a000177189 What is the difference between an informat and a format? Name three informats or formats . INFORMAT Statement - Associates informats with variables It’s basically used in an input / SQL create table statements to read external file raw data or data that is not in a SAS format. http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000178244.htm eg: commaw. datew. Wordatew. dollarw. $varyinglengthw. FORMAT Statement Associates formats with variables It’s basically used in a datastep format / SQL select / Procedure format statements to output SAS data to a file/report etc. Formats can look-like informats but are differentiated as to which statement they are used in…
Background image of page 2
eg. Datew., Worddatew., mmddyyw. http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000178212.htm
Background image of page 3

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

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

Page1 / 22

23376754-SAS-Interview-Questions-and-Answers-1 - What SAS...

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

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