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
B
ReplyDeleteB
ReplyDeleteCould you explain why B?
ReplyDeleteAnswer is D
ReplyDeleteAnswer 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.
ReplyDeleteThe answer is B. Sweta always gives wrong answers only everywhere.
ReplyDeleteNo bullying...
DeleteSascert: I was confused too, but if you think logically then you will narrow down to right answer. Sweta keep up .
ReplyDeleteCoz there is no such keyword like 'ascending'...
DeleteBut, nice try, Sweta! Everybody can try.
default sort order is ascending. So ascending should not be mentioned in the by statement.
ReplyDeleteMoreover, you'll know that typing ascending in by statement is wrong because it doesn't turn blue color like the keyword descending.
B for sure
ReplyDeleteB
ReplyDeleteeven its default by not specifying ascending but isn't D still going to work?
ReplyDeletehello is some body still seeing this blog or it just me
ReplyDeletenice answers
ReplyDeleteD won't work since 'ascending' is not a keyword in SAS and is the default in any case.
ReplyDeleteIn SQL it looks like this:
ReplyDeleteproc sql;
select IDNumber, Expenses from EMPLOYEE_INFO
order by idnumber asc, expenses asc;
Ans: B
ReplyDeleteB
ReplyDelete