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
For what purpose would you use the RETAIN statement?
Do we follow ADAM in analysis dataset development?How? Usually which version? Why is it necessary?
which date function advances a date, time or datetime value by a given interval? : Sas programming
Explain the difference between nodup and nodupkey options?
name the scheduler for scheduling job and explain the scheduler? : Sas-di
What are the uses of sas?
How does proc sql work?
What would you change about your job?
Differentiate between proc means and proc summary.
explain the key concept of sas? : Sas-administrator
what is sas olap server? : Sas-di
What is the purpose of _character_ and _numeric_?
Mention what is SAS data set?
for what purpose would you use the retain statement? : Sas programming
How substr function works in sas?