Under what circumstances would you code a SELECT construct
instead of IF statements?
Answer Posted / rushi
When you have a long series of mutually exclusive conditions and the comparison is numeric, using a SELECT group is slightly more efficient than using IF-THEN or IF-THEN-ELSE statements because CPU time is reduced.
The syntax for SELECT WHEN is as follows :
SELECT (condition);
WHEN (1) x=x;
WHEN (2) x=x*2;
OTHERWISE x=x-1;
END;
Example :
SELECT (str);
WHEN ('Sun') wage=wage*1.5;
WHEN ('Sat') wage=wage*1.3;
OTHERWISE DO;
wage=wage+1;
bonus=0;
END;
END;
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
I have a dataset concat having variable a b & c. How to rename a b to e & f?
what are the best practices to process the large data sets in sas programming? : Sas-administrator
what is the difference between floor and ceil functions in sas? : Sas-administrator
Describe the function and utility of the most difficult SAS macro that you have written?
What do you code to create a macro? : sas-macro
How to import multiple xls files into sas. Out of those files, how to get different values from a single variable and how to find number of rows per value type? We can do this using group by for one xls file with proc sql. Was wondering how I can achieve this for multiple files at the same time. Any ideas?
what can you learn from the sas log when debugging? : Sas programming
Explain proc univariate?
Difference between SAS STATA & SPSS?
what is the different between functions and procs that calculate the same simple descriptive statistics? : Sas programming
how can you import .csv file in to sas? : Sas programming
Have you ever used the SAS Debugger?
what r the job openings SAS for fresher graduates !
Explain by-group processing?
what are the scrubbing procedures in sas? : Sas programming