ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 68

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

14 comments:

  1. Anonymous12:55 PM

    i had run this program on SAS and the Ans is D

    ReplyDelete
  2. Anonymous4:51 PM

    D, Ascending destionaiton, descdending revenue

    ReplyDelete
  3. Anonymous3:42 PM

    why is D? i think its C. D would be if both were ascending

    ReplyDelete
  4. Anonymous12:33 PM

    It is D.

    The 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).

    ReplyDelete
  5. Anonymous2:23 PM

    Good answer.
    Default is ascending,
    Descending only modifies the variable directly after it.

    ReplyDelete
  6. Anonymous8:57 PM

    Thank you for your post. This is excellent information.
    It is amazing and wonderful to visit your site
    goldenslot

    ReplyDelete
  7. Anonymous10:04 PM

    Anyone familiar with SQL will note this is syntax for ordering sorts is reversed from tradtional SQL.

    data 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;

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete