The SAS data set WORK.AWARDS is listed below:
fname points
Amy 2
Amy 1
Gerard 3
Wang 3
Wang 1
Wang 2
The following SAS program is submitted:
proc sort data = work.awards;
by descending fname points;
run;
Which one of the following represents how the observations are sorted?
A. Wang 3
Gerard 3
Wang 2
Amy 2
Wang 1
Amy 1
B. Wang 3
Wang 2
Wang 1
Gerard 3
Amy 2
Amy 1
C. Wang 3
Wang 1
Wang 2
Gerard 3
Amy 2
Amy 1
D. Wang 1
Wang 2
Wang 3
Gerard 3
Amy 1
Amy 2
Click Comment link to get answer
B
ReplyDeleteD
ReplyDeleteD
ReplyDeleteIts D
ReplyDeleteD
ReplyDeleteD
ReplyDeleteB
ReplyDeleteFek You Usha
DeleteYeah, for giving out the wrong answer. Fuck you, Usha
DeleteITS D
ReplyDeletedata awards;
input Name $ Points;
cards;
Amy 2
Amy 1
Gerard 3
Wang 3
Wang 1
Wang 2
;
proc sort data=awards;
by decending Name Points;
Run;
Proc print data=awards;
Run;
/*****RESULTS
The SAS System 16:39 Sunday, November 19, 2000 1
Name Points
Wang 1
Wang 2
Wang 3 Gerard 3
Amy 1
Amy 2
it displays descending order for the first variable so ans is d
ReplyDeleteB
ReplyDeletesorry its not B ,its D.
ReplyDeletedata awards;
ReplyDeleteinput Name $ Points;
cards;
Amy 2
Amy 1
Gerard 3
Wang 3
Wang 1
Wang 2
;
proc sort data=awards;
by decending Name decending Points;
Run;
Proc print data=awards;
Run;
OUTPUT:
Obs Name Points
1 Wang 3
2 Wang 2
3 Wang 1
4 Gerard 3
5 Amy 2
6 Amy 1
Reason: Name is sorted in Desceding order and it can by any Wang but points is by default sorted in ascendign order therefore
ReplyDeletename: points
wang 1
wang 2
wang 3 and so on.
D
ReplyDeleteD
ReplyDeleteReason is SAS only applies the descending order to the immediate variable next to it, the descending term wont affect the second variable points...
ReplyDeleteExcellent, this clarified my confusion. Thanks.
DeleteThe answer is D. fname is descending & points in ascending order.
ReplyDeleteThank you all for the comments
ReplyDeletewhy not C
ReplyDelete