SAS Certified Adv Programmer 130 Questions (35)
The following SAS FORMAT procedure is submitted:
proc format lib = sasuser; value tempc low < 0 = 'BELOW FREEZING' 0<5 = 'COLD' 5< 10= 'MILD' 10< 15 = 'WARM' 15 < high = 'HOT'; run;
How is the value 10 displayed when the format TEMPC is applied?
A.10
B. MILD
C. WARM
D. BELOW FREEZING
Topics:
SAS Adv Questions |
8 Comments »
C
I think the definition of the format is wrong due to lack ‘-‘ for the range define.
The definition is incorrect. The correct definition should be proc format lib = sasuser;
value tempq
low – < 0 = 'BELOW FREEZING'
0 – <5 = 'COLD'
5 – < 10= 'MILD'
10 – < 15 = 'WARM'
15 < – high = 'HOT';
run;
the “less than” operator (<) is used to show a non-inclusive range (10 – <15) indicates that the 10 value is not included in the range). The Answer would be A.
Yeah, should be 10-<15 = 'WARM'
A: because the format does not specify the case where it is then
syntax error in the range specification of value :
it should be
proc format lib = sasuser;
value tempc
low-0 = ‘BELOW FREEZING’
0<-5 = 'COLD'
5<-10= 'MILD'
10<-15 = 'WARM'
15< -high = 'HOT';
run;
and based on this , the answer should be B
proc format;
value tempC
low < 0 = 'BELOW FREEZING'
0 < 5 = 'COLD'
5 < 10 = 'MILD'
10 < 15 = 'WARM'
15 < High = 'HOT' ;
run;
data x2;
input temp @@;
Convtemp = put(temp,tempc.);
datalines;
10 10.2 9.9 10.02
;
run;
temp convtemp
10 mild (doesn't make sense);
On the other hand 10 is included in the WARM range; WARM may be correct, while MILD covers < 10??
based on sy’s logic
should it be C?