47 data numrecords;
48 infile 'file-specification';
49 input @1 patient $15. relative $ 16-26 @;
50 if relative = 'children' then input @54 diagnosis $15. @;
51 else if relative = 'parents' then input @28 doctor $15. clinic $ 44-53 @54 diagnosis $15. @;
52 input age;
NOTE: The data set WORK.NUMRECORDS has 3 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
Mike Edwards parents Sara Patrik clinic1 cancer 23
ketty Perry children Russel pete clinic3 cancer 25
Jones Mark parents Russel pete clinic3 cancer 35
The statement input @1 patient $15. relative $ 16-26 @; is using the @ symbol at the end. An INPUT statement with this 'at' sign (@) at the end is called a 'trailing at'. This tells SAS to hold that line of raw data. While the trailing @ holds that line, you can test the observation with an IF statement to see if it is one you want to keep. If it is, then you can read data for the remaining variables with a second INPUT statement.
The values for variables doctor and clinic are only read by SAS when the condition for statement else if relative = 'parents' then is TRUE. Here, in each iteration one raw data record will be read by SAS so option A is correct.
The one and only FREE resource for general SAS online training as well as study guides for the SAS Base Certification. My goal is to create the SAS Certification prep guide that I never found but always wanted. This should also be a place to come if you are new to the language but are simply looking for online SAS training.