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
How do you add a number to a macro variable? : sas-macro
how does sas handle missing values in procs? : Sas programming
What is run-group processing?
Explain the purpose of substr functions in sas programming.
why is sas considered self-documenting? : Sas programming
What is the use of divide function?
What is the use of function Proc summary?
how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming
Explain data_null_?
What is the order of application for output data set options, input data set options and SAS statements?
Do you know the features of sas?
what is enterprise guide? What is the use of it? : Sas programming
What versions of SAS have you used (on which platforms)?
for report generation which one you used proc report or data_null_?
Describe the function and utility of the most difficult SAS macro that you have written?