Under what circumstances would you code a SELECT construct
instead of IF statements?

Answers were Sorted based on User's Feedback



Under what circumstances would you code a SELECT construct instead of IF statements?..

Answer / juan

SELECT statement can do logical test. A SELECT statement
provides an alternative to a series of IF and ELSE IF
statements. It is usually more efficient than IF-THEN/ELSE,
especially if you are recoding a variable into a large
number of categories.

Is This Answer Correct ?    7 Yes 0 No

Under what circumstances would you code a SELECT construct instead of IF statements?..

Answer / venkatesh.layam

when ever we wre do the task on puarticular variable select
works efficiently than if then else
And it will check immideatly and occupies less space.
it will give good shape out for data.

Is This Answer Correct ?    6 Yes 0 No

Under what circumstances would you code a SELECT construct instead of IF statements?..

Answer / gangadhar

IF STATEMENT IS MAINLY USED FOR SUBSETTING OF DATA.IN THE
SAME WAY SUBSETTING IN SQL SELECT STATEMENT IS USED.

Is This Answer Correct ?    2 Yes 2 No

Under what circumstances would you code a SELECT construct instead of IF statements?..

Answer / prakask

i think select statements are used when we are using 1
condition to compare with several conditions

Is This Answer Correct ?    2 Yes 2 No

Under what circumstances would you code a SELECT construct instead of IF statements?..

Answer / sonu

The SELECT statement begins a SELECT group. SELECT groups contain WHEN statements that identify SAS statements that are executed when a particular condition is true. Use at least one WHEN statement in a SELECT group. An optional OTHERWISE statement specifies a statement to be executed if no WHEN condition is met. An END statement ends a SELECT group.
Null statements that are used in WHEN statements cause SAS to recognize a condition as true without taking further action. Null statements that are used in OTHERWISE statements prevent SAS from issuing an error message when all WHEN conditions are false.
Using Select-When improves processing efficiency and understandability in programs that needed to check a series of conditions for the same variable.
Use IF-THEN/ELSE statements for programs with few statements.
Using a subsetting IF statement without a THEN clause could be dangerous because it would process only those records that meet the condition specified in the IF clause.

Is This Answer Correct ?    0 Yes 0 No

Under what circumstances would you code a SELECT construct instead of IF statements?..

Answer / 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

Under what circumstances would you code a SELECT construct instead of IF statements?..

Answer / kumarrd

when ever we want check with more than condition we may use
if condition rather than select one

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More SAS Interview Questions

Hi im new to sas. I have a file with some charecter variables and some numeric variables now i want to load charecter variables into one datastep and numeric variables into another data step pls let me know Thanks

2 Answers  


What is shift table? have you ever created shift that?

2 Answers   Accenture, Clinical Research, Quintiles,


Do you need to combine data sets? How should you combine data sets– MERGE or SET statements in DATA steps,PROC APPEND,PROC SQL?

3 Answers  


I have 3 years of work experience at a startup and recently got certified in Data Science with SAS. I need to know how to get into the analytics industry

0 Answers  


What is the SAS data set?

0 Answers  






Explain data_null_?

0 Answers  


Which is the Best SAS training Institute in Delhi NCR for SAS certification preparation

1 Answers   SAS,


Hello, I have PROC SQLs results group by 3 fields and I use SUM and COUNT functions in SQL. The problem is when I try to display my result with PROC TABULATE. I am getting very big numbers. I believe I make a mistake some where in Tabulate. Here is my Proc Tabulate. PROC TABULATE DATA=OUT04_05 FORMAT=12.; CLASS YR CENTRE VISA / PRELOADFMT EXCLUSIVE; VAR NEWUSER FRAUD TRANSFER AUTUSER REISSUE; TABLE CENTRE ALL, (YR ALL)*VISA, (NEWUSER*F=COMMA12. AUTUSER*F=COMMA12. FRAUD*F=COMMA12. TRANSFER*F=COMMA12. REISSUE*F=COMMA12.) / MISSTEXT={LABEL='0'} PRINTMISS RTS=20; FORMAT VISA VISAFMT.; KEYLABEL SUM = ' ' ALL = 'TOTAL'; LABEL YR = 'DATE YEAR' NEWUSER = 'TOTAL NEW ACCT' TRANSFER = 'TOTAL TRANSFER' FRAUD = 'TOTAL FRAUD TRANSFER' AUTUSER = 'TOTAL AUTH USERS' REISSUE = 'TOTAL REISSUE'; When I code it like : NEWUSER*N*F=COMMA12. AUTUSER*N*F=COMMA12. I get same amount numbers but to find a NEWUSER I use COUNT(*) and to find AUTUSER I use SUM(xxxx) function so both result shouldn’t be the same my problem is in this point. Could you tell me where the problem in code is. How can I display my result? TX.

0 Answers  


what are different type of sas servers ? On which server does the sas code execute ?

4 Answers   TCS,


What r all the reporting procedures...?

3 Answers  


what are the benefits of data integration? : Sas-di

0 Answers  


define table lookup and how may ways it can be done...explian

3 Answers  


Categories