ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 70

The SAS data set EMPLOYEE_INFO is listed below:
IDNumber Expenses
2542 100.00
3612 133.15
2198 234.34
2198 111.12
The following SAS program is submitted:
proc sort data = employee_info;

run;
Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within
each ascending IDNUMBER value?
A. by Expenses IDNumber;
B. by IDNumber Expenses;
C. by ascending (IDNumber Expenses);
D. by ascending IDNumber ascending Expenses;
Click Comment link to get answer

19 comments:

  1. Anonymous7:21 AM

    Could you explain why B?

    ReplyDelete
  2. sweta3:07 PM

    Answer is D

    ReplyDelete
  3. Answer is B. By default SAS will sort in ascending order, if you want descending then you specify descending keyword before the variable name. Now here we want ascending expense values within each ascending IDNUMBER value in our by statement we should have IDNUMBER first and then expenses.

    ReplyDelete
  4. Anonymous6:16 PM

    The answer is B. Sweta always gives wrong answers only everywhere.

    ReplyDelete
  5. Anonymous2:16 PM

    Sascert: I was confused too, but if you think logically then you will narrow down to right answer. Sweta keep up .

    ReplyDelete
    Replies
    1. Anonymous5:05 PM

      Coz there is no such keyword like 'ascending'...
      But, nice try, Sweta! Everybody can try.

      Delete
  6. Remya1:42 PM

    default sort order is ascending. So ascending should not be mentioned in the by statement.

    Moreover, you'll know that typing ascending in by statement is wrong because it doesn't turn blue color like the keyword descending.

    ReplyDelete
  7. even its default by not specifying ascending but isn't D still going to work?

    ReplyDelete
  8. hello is some body still seeing this blog or it just me

    ReplyDelete
  9. nice answers

    ReplyDelete
  10. Anonymous10:50 PM

    D won't work since 'ascending' is not a keyword in SAS and is the default in any case.

    ReplyDelete
  11. Anonymous10:59 PM

    In SQL it looks like this:

    proc sql;
    select IDNumber, Expenses from EMPLOYEE_INFO
    order by idnumber asc, expenses asc;

    ReplyDelete