12-20-2016 01:23 AM
The contents of the raw data file TEAM are listed below:
The following SAS program is submitted:
input name $15. age 2.;
put name $15. +5 age 2.;
Which one of the following describes the output created?
A. a raw data file only
B. a SAS data set named GROUP only
C. a SAS data set named GROUP and a raw data file
D. No output is generated as the program fails to execute due to errors.
I am not able to get a clear picture of how "+" pointer is working here. Could anyone please explain this ?
12-20-2016 01:35 AM
+5 would add 5 spaces after printing name variable. As name itself is 15 char long so age would be printed after 15 characters.
You can try giving +50 insted of+5 and see the log you would understand the usage. Try the below program.
data group; /* infile 'team'; */ input name $15. age 2.; /* file 'file-specification'; */ put name $15. +5 age 2.; datalines; Janice 10 Henri 11 Michael 11 Susan 12 ;
12-20-2016 01:48 AM
Thank you, I tried the below code. I have understood the use of "+" symbol here, but in the output I am only getting one record which is for Henri. Why is that so?
12-20-2016 10:49 AM
Look in your log. Do you see any messages about SAS went to the next line?
You may be requesting to read more data than exists on a single line.
Also when asking why something happened it often helps to post the code from the log along with any messages.