Multiple choice technology programming languages

You have to sort the dataset Temp by the values of salary in descending order. SORT procedure is given below. Find out the missing statement? Data temp; Infile datalines; Input empname $ salary; Datalines; AAA 25000 BBB 45000 CCC 36000 DDD 47000 ; Proc sort data=temp; <<<<<<>>>>>>>>>; Run;

  1. by descending salary

  2. by salary descending

  3. by salary ascending

  4. by salary

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In PROC SORT, the correct syntax for descending order is 'by descending variable-name'. The keyword DESCENDING must come BEFORE the variable name. Option B reverses this (incorrect), C uses ascending (wrong), and D is ascending by default.

AI explanation

To sort a SAS dataset by a variable in descending order, the BY statement in PROC SORT needs the DESCENDING keyword placed immediately before the variable name, as in BY DESCENDING salary;. Writing BY salary DESCENDING or BY salary (without descending) would either be invalid syntax or sort ascending instead, which doesn't meet the stated requirement.