Under what circumstances would you code a SELECT construct
instead of IF statements?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com
How would you code the criteria to restrict the output to be produced?
What is the difference between an informat and a format? Name three informats or formats.
how to get second highest salary from a employee table and how get a 5th highest salary from a employee table?
What would the following datastep do? Data _null_; Set Dist end=eof; Call Symput("xx"!!left(put(_n_,2.)),&dimension); If EOF then Call Symput('numrows',left(put(_n_,2.))); Run; dimension is a macro variable that is being passed here
is it possible to generate sas datasets using proc print ???
1 Answers GSK GlaxoSmithKline,
what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming
Have you ever linked SAS code, If so, describe the link and any required statements used to either process the code or the step itself?
What is univariate n where it can be used n how...?
What are the parameters of scan function?
How will you generate test data with no input data?
Do you need to combine data sets? How should you combine data sets– MERGE or SET statements in DATA steps,PROC APPEND,PROC SQL?