Reading multiple records
Another way to accomplish the same thing is with the following INPUT statement.
INPUT @1 ID 3. @5 GENDER $1. @7 AGE 2. @10 HEIGHT 2. @13 DOB MMDDYY6. / @5 SBP 3. @9 DBP 3. @13 HR 3.;
What is new is the / absolute record pointer in the INPUT statement. This option tells SAS to go to the next record before reading the next set of variables.
Actually, with this set of data, you could dispense with all the @n, /, and #n pointers altogether and just use list input. SAS will run out of data in a line after reading DOB and automatically read another line in order to read a data value into SBP. This would be risky code though; write your code according to the data description, not the set of data you have in front of you today.
pointer-control (input statement)
|
The relative row pointer (#n) is preferred because you can go backward as well as forwards and because it is easier to not miscount the number of slashes.
Note that with these row pointers you can also skip selected records entirely (see example 7.2 in chapter 1).