In a SAS DATA step, which approach correctly reads the 3rd column (columns 15-16) as a 2-character state code from a fixed-width text file?
Select an answer to reveal the explanation.
Short Explanation
You need to jump to column 15 and read two characters as text, so use the column pointer with a 2-character character informat. That tells SAS exactly where the state code starts and how wide it is.
Full Explanation
The correct approach is to use a column pointer control that moves the input pointer to column 15 and then read the value as a 2-character character value using the $2. informat. This matches the fixed-width layout because the state code is in columns 15-16 and must be treated as text. Reading with $CHAR2. alone is wrong because it does not position the pointer at column 15. Using a parenthesized variable with ($2.) is wrong because it lacks the column pointer. Putting the column pointer after the variable is syntactically incorrect.