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


Please Help Members By Posting Answers For Below Questions

How are numeric and character missing values represented internally?

1132


: and & modifiers.

858


What do you know about symput and symget?

727


what are some good sas programming practices for processing very large data sets? : Sas programming

507


how do you want missing values handled? : Sas programming

532






what is sas metadata repository? : Sas-bi

596


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??

2089


What is the function of output statement in a SAS Program?

606


do you need to know if there are any missing values? : Sas programming

544


Name some categories in sas 9? : sas-grid-administration

555


for whom is sas data integration studio designed? : Sas-di

554


Have you used macros? For what purpose you have used? : sas-macro

557


why is a stop statement needed for the point=option on a set statement? : Sas programming

583


why is sas data integration studio important? : Sas-di

557


what are 5 ways to perform a table lookup in sas? : Sas-administrator

759