The Line Number Pointer (#) in SAS Input Statements


Sometimes one has multiple lines of data for each subject. For example, one of my graduate students obtained, from an archival source, a data file with sixteen lines of data for each subject. She wanted to read only the data on the 10th line for each subject. Here is what I prepared for her:

options formdlim='' pageno=min nodate;
title 'Read Megan''s Data';
data risky; infile 'D:\StatData\risk-Megan.dat';
input #10 subid risk x3 x4 x5 x6 activ $ #16;
proc print; run;

On the input statement, #10 tells SAS to start reading on the tenth line. Seven variables are read from that line. Since she did not want to read any data from other lines, the #16 was used to advance the input pointer to the 16th line and then the semicolon ended the input statement. Proc Print was used just to confirm that the data were correctly read.

Back to the SAS Help Page

Visit Karl's Index Page


Contact Information for the Webmaster,
Dr. Karl L. Wuensch



This page most recently revised on 15. April 2002.