Question8:ThecontentsoftherawdatafileNAMENUMarelistedbelow:
--------10-------20-------30
Joexx
ThefollowingSASprogramissubmitted:
datatest;
infile'namenum';
inputname$number;
run;
WhichoneofthefollowingisthevalueoftheNUMBERvariable?
1.xx
2.Joe
3..(missingnumericvalue)
4.Thevaluecannotbedeterminedastheprogramfailstoexecuteduetoerrors.
CorrectAnswer:3
Exp:missingvalue,sinceanumericvalueisexpectedforthevariablebeenread,andacharactervaluewasfound.
Youhavegivennameascharacterandtherewasnodelimitermeansdefaultspacewillbeusedasdelimiterhere.SonamewillreadJoeandnumberisexpectingnumericvaluebutit
readsxx,sonumberissettomissing.
SASencounterscharacterdatafornumericdataandsets_error_=1.However,SASstillrunsthecodeandgeneratesanlistfilewithname=Jeoandnumberissettoamissingvalue.