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
Mention what is SAS data set?
what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming
what is intially documentation in sas?
How would you define the end of a macro? : sas-macro
In ARRAY processing, what does the DIM function do?
what is SAS OPTIMIZATION?
What are the features of SAS?
How would you identify a macro variable?
What do you know about sas data set?
What are the new features included in the new version of SAS Programming Language?
What is the difference between where and if statement?
What are the ways to do a “table lookup” in sas?
what is hierarchy flattening? : Sas-di
Which are the statements whose placement in the data step is critical?
what are the considerations when picking a SAS/STAT procedure?