I was looking at the SAS base exam questions and I came across this particular one:
data test;
input employee_name $ 1-4;
if employee_name = ‘Ruth’ then input idnum 10-11;
else input age 7-8;
datalines;
Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44
;
run;
At first I thought the IDNum when the employee name is "Ruth" would be 11, but it seems it skips the Ruth row and jumps down to the second row, and inputs 22 instead. And why is Sue's age 40 instead of 30? Can someone explain why this is? Thank you.
Here is the result:
Name IDnum Age
Ruth 22
Sue 40
Aucun commentaire:
Enregistrer un commentaire