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 are numeric and character missing values represented internally?
: and & modifiers.
What do you know about symput and symget?
what are some good sas programming practices for processing very large data sets? : Sas programming
how do you want missing values handled? : Sas programming
what is sas metadata repository? : Sas-bi
Will it bother you if the guy at the next desk times the frequency and duration of your bathroom or coffee breaks on the grounds that ?you are getting paid twice as much as he is??
What is the function of output statement in a SAS Program?
do you need to know if there are any missing values? : Sas programming
Name some categories in sas 9? : sas-grid-administration
for whom is sas data integration studio designed? : Sas-di
Have you used macros? For what purpose you have used? : sas-macro
why is a stop statement needed for the point=option on a set statement? : Sas programming
why is sas data integration studio important? : Sas-di
what are 5 ways to perform a table lookup in sas? : Sas-administrator