The following SAS program is submitted:
data work.flights;
destination = 'CPH';
select(destination);
when('LHR') city = 'London';
when('CPH') city = 'Copenhagen';
otherwise;
end;
run;
Which one of the following is the value of the CITY variable?
A. London
B. Copenh
C. Copenhagen
D. ' ' (missing character value)
Click Comment link to get answer
B
ReplyDeleteB
ReplyDeleteB
ReplyDeleteI think its B
ReplyDeletesee
ReplyDeletecity = 'London' - Length of assignment.
Second assignment
when('CPH') city = 'Copenhagen';
will cut down the words.
Answer will be Copenh
This comment has been removed by the author.
ReplyDeleteNotice that the LENGTH statement in the SELECT group has not been specified. Remember that without the LENGTH statement, values for Group might be truncated, as the first value for Group (London) is not the longest possible value.
ReplyDeleteSo, the answer is B.
Ferrat
length没制定city,默认为london的长度--6位
ReplyDelete啧啧,不用英文
Delete头一次看见中文,呵呵!
Delete哈哈哈 求多多发言!
Deletekanji?
Delete感觉比印度朋友的解释简洁很多,开心
Delete谢谢老哥。
Deleteинглиш плиз
ReplyDeleteधन्यबाद सुकृया , सत्सृकाल
ReplyDeletedata work.flights;
ReplyDelete99 destination = 'CPH';
100 select(destination);
101 when('LHR') city = 'London';
102 when('CPH') city = 'Copenhagen';
103 otherwise;
104
105 end;
106 put city= ;
107 run;
city=Copenh
Thanks Ferat for your quality explanation. B it is.
ReplyDeleteHere is the SAS output
ReplyDeleteObs destination city
1 CPH Copenh
Answer is B because of the first occurrence of LONDON, 6 chars,
B
ReplyDeletedata work.class;
ReplyDeleteset sashelp.class(keep=name age);
if age>=13 then group='Teen';
if 11<=age<=13 then group='Pre-Teen';
run;
what is the output if age is 13
pre teen
Deletepre teen
DeletePre-
DeleteBecause group length set to 4 first(Teen),so in the next condition it will read only 4 characters
Ans is D;
ReplyDeleteWhich one of the following is the value of the CITY variable?
in ques. City variable mention as CITY & variable name would be case sensitive
The ans would be B. Copenh.
DeleteBecause length of a variable is assigned to PDV as per its first appearance. And so variable (city) will have a length of 6 characters(because london has 6 characters).
D for sure
DeleteThis comment has been removed by the author.
ReplyDelete