The SAS data set QTR1_REVENUE is listed below:
destination revenue
YYZ 53634
FRA 62129
FRA 75962
RDU 76254
YYZ 82174
The following SAS program is submitted:
proc sort data = qtr1_revenue;
by destination descending revenue;
run;
Which one of the following represents the first observation in the output data set?
A. destination revenue
YYZ 82174
B. destination revenue
YYZ 53634
C. destination revenue
FRA 62129
D. destination revenue
FRA 75962
Click Comment link to get answer
D
ReplyDeleteD
ReplyDeletei had run this program on SAS and the Ans is D
ReplyDeleteD, Ascending destionaiton, descdending revenue
ReplyDeletewhy is D? i think its C. D would be if both were ascending
ReplyDeleteA
ReplyDeleteIt is D.
ReplyDeleteThe word descending only modifies the variable directly after it.
so "by destination descending revenue" causes destination to be in ascending order (A,B,C,D,E,F,G)and revenue will be in descending order (9,8,7,6,5,4,3).
Good answer.
ReplyDeleteDefault is ascending,
Descending only modifies the variable directly after it.
D
ReplyDeleteD
ReplyDeleteThank you for your post. This is excellent information.
ReplyDeleteIt is amazing and wonderful to visit your site
goldenslot
Anyone familiar with SQL will note this is syntax for ordering sorts is reversed from tradtional SQL.
ReplyDeletedata QTR1_REVENUE;
input destination $ revenue ;
cards;
YYZ 53634
FRA 62129
FRA 75962
RDU 76254
YYZ 82174
;
proc print data=QTR1_REVENUE;
title 'QTR1_REVENUE';
run;
proc sort data=QTR1_REVENUE;
by destination descending revenue;
run;
proc print data=QTR1_REVENUE;
title "destination descending revenue";
run;
proc sql;
select destination, revenue from QTR1_REVENUE
order by destination, revenue desc;
This comment has been removed by the author.
ReplyDeleteD
ReplyDelete