Combining Line Pointer Controls

The forward slash (/) line pointer control and the #n line pointer control can be used together in a SAS program to read multiple records both sequentially and non-sequentially.
For example, you could use both the / line pointer control and the #n line pointer control to read the variables in the raw data file Patdata in the following order:
1. ID
2. Fname
3. Lname
4. Address
5. City
6. State
7. Zip
8. Doctor
 data perm.patients; 
    infile patdata; 
    input #4 ID $5. 
          #1 Fname $ Lname $ /  
             Address $23. / 
             City $ State $ Zip $ / 
             @7 Doctor $6.; 
run;
Raw Data File with the First Four Records Highlighted
  • To read the values for ID in the fourth record, specify #4 before naming the variable and ...

Get SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.