The following SAS program is submitted using the raw data file as input:
data work.family;
infile 'file-specification';
input @1 date_of_birth mmddyy10.
@15 first_name $5.
@25 age 3;
run;
proc print data=work.family noobs;
run;
Which one of the following is the result?
a.The program executes, but the age values are missing in the output.
b.The program executes, but the date values are missing in the output.
c.The program fails to execute because the age informat is coded incorrectly.
d.The program fails to execute because the date informat is coded incorrectly.
This is one of SAS Practice Questions from SAS. The correct answer is A. I chose C. The informat for age is coded incorrectly. Since
age is standard numeric input, it should use the w.d informat to specify a field width of 3 in the INPUT statement.
My understanding is that the period missed in the w.d informat is a syntax error. Then SAS fails to execute. Anyone please help?
Both of these would be the correct way to get the contents of column 3:
input @3 age 1.;
input age 3;
This also takes the contents of column 3:
input @25 age 3;
It essentially says, "Move to column 25. Then get the contents of age from column 3."
Since column 3 contains a slash (part of the date), the AGE values are missing.
Both of these would be the correct way to get the contents of column 3:
input @3 age 1.;
input age 3;
This also takes the contents of column 3:
input @25 age 3;
It essentially says, "Move to column 25. Then get the contents of age from column 3."
Since column 3 contains a slash (part of the date), the AGE values are missing.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.