SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Reading Free-Format Data
Modifying List Input


Comparing Formatted Input and Modified List Input

As you have seen, informats work differently in modified list input than they do in formatted input. With formatted input, the informat determines both the length of character variables and the number of columns to be read. The same number of columns are read from each record.

     input @4 City $12.; 
   123456789--12
1---+----10---+----20---+--
 1 NEW YORK     7,262,700 
 2 LOS ANGELES  3,259,340 
 3 CHICAGO      3,009,530 
 4 HOUSTON      1,728,910 
 5 PHILADELPHIA 1,642,900 
   123456789--12
1---+----10---+----20---+--
 1 NEW YORK     7,262,700 
 2 LOS ANGELES  3,259,340 
 3 CHICAGO      3,009,530 
 4 HOUSTON      1,728,910 
 5 PHILADELPHIA 1,642,900 


The informat in modified list input determines only the length of the variable, not the number of columns to be read. Here, the raw data values are read until two consecutive blanks are encountered.

     input City & $12.; 
   12345678
1---+----10---+----20---+--
 1 NEW YORK  7,262,700 
 2 LOS ANGELES  3,259,340 
 3 CHICAGO  3,009,530 
 4 HOUSTON  1,728,910 
 5 PHILADELPHIA  1,642,900 
   123456789--12
1---+----10---+----20---+--
 1 NEW YORK  7,262,700 
 2 LOS ANGELES  3,259,340 
 3 CHICAGO  3,009,530 
 4 HOUSTON  1,728,910 
 5 PHILADELPHIA  1,642,900 



back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement