I'm working with a file that has a variable-length record format. Specifically, the last field contains character strings of differing lengths. Worse yet, this field will have embedded blanks. It's a character variable that can contain expressions like, "Hi there" and "A bientot". How can I get SAS to read this file?
One way to get SAS to read the last field as a variable-length field is to assign the variable the maximum necessary length by using the LENGTH statement (before the INPUT statement). Use an ampersand sign (&) to tell SAS to expect one or more single embedded blanks in a character-valued variable. For example:
DATA temp;
INFILE 'raw dat a';
LENGTH name $ 50 ;
INPUT v1 $ 7-21 @23 name & $ ;
RUN ;
For more information, click on the Help button in the SAS menu bar and scroll to SAS Help and Documentation.
If you have further questions, send E-mail to stats@ssc.utexas.edu.