To read in an external raw data file in a DATA step, you would use:
1) The FILENAME statement to specify the location of the file.
2) The INFILE statement to identify the external file to read with an INPUT statement.
3) The INPUT statement to specify the variables that the data is identified with and read in the needed variables using column/line pointers, informats, and length specifiers.
To read in an external raw data file in a DATA step, you would use:
1) The FILENAME statement to specify the location of the file.
2) The INFILE statement to identify the external file to read with an INPUT statement.
3) The INPUT statement to specify the variables that the data is identified with and read in the needed variables using column/line pointers, informats, and length specifiers.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
To read in an external raw data file in a DATA step, you would use:
1) The FILENAME statement to specify the location of the file.
2) The INFILE statement to identify the external file to read with an INPUT statement.
3) The INPUT statement to specify the variables that the data is identified with and read in the needed variables using column/line pointers, informats, and length specifiers.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
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=delim iter( s) specifies an alternate delimiter (other than a blank) to be used for LIST input D SD (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 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.