In the SAS Data step what is the difference between the
subsetting done by Where and subsetting done by If?

Answers were Sorted based on User's Feedback



In the SAS Data step what is the difference between the subsetting done by Where and subsetting don..

Answer / k

There is difference between how SAS handles IF and WHERE
conditions. The 'WHERE' condition is applied on data before
they enter Program Data Vector (PDV) and in case of 'IF' it
is applied after data comes out from PDV. Now, if you have
created a variable in the same data step using
Where : the created variable will not be applied condition.
IF: the created variable will be subjected to the condition
applied.

Is This Answer Correct ?    19 Yes 0 No

In the SAS Data step what is the difference between the subsetting done by Where and subsetting don..

Answer / gangadhar

Make sure you apply the following rules when determining
which approach to take when subsetting your data set using
the DATA step. If your subset condition does not meet the
requirements below, then the WHERE and IF statements should
produce identical results. For cases such as this, use the
WHERE statement since it is more efficient. Note that
having both WHERE and IF statements within the same DATA
step has a cumulative effect.
• Can use WHERE statement when only specifying data
set variables
• Use IF statement when specifying automatic
variables or new variables created within DATA step
• Use IF statement when specifying FIRST.BY or LAST.
BY variables
• Use IF statement when specifying data set options
such as OBS = , POINT = or FIRSTOBS =
• In general, use IF statement when merging data sets
to apply subset condition after merging data set
• Use WHERE statement when specifying indexes

Is This Answer Correct ?    6 Yes 0 No

In the SAS Data step what is the difference between the subsetting done by Where and subsetting don..

Answer / s.s.suresh

WHERE Statement can be only be used with variables in the
existing dataset where as IF statement can also be used raw
data as well

Is This Answer Correct ?    7 Yes 1 No

In the SAS Data step what is the difference between the subsetting done by Where and subsetting don..

Answer / chowdary vamsi

Where:first chick the condensation ofter checking the errors
if:first chick the errors after chick the condensation
where :take more processing time compare if
if take less processing time compare to where.

Is This Answer Correct ?    0 Yes 0 No

In the SAS Data step what is the difference between the subsetting done by Where and subsetting don..

Answer / govardhan bandari

IF-Works With New Variable
Where- Cant work With New Variables

IF-Works After PDV
Where-Works Before PDV

IF-in backend if process all the variable and it gives output based on condition
BUT
Where-process only conditionally met obseravtions

IF-Cant work with proceduers(except proc report with compute statement)
WHERE- work with proceduers

Is This Answer Correct ?    0 Yes 0 No

In the SAS Data step what is the difference between the subsetting done by Where and subsetting don..

Answer / ramesh

Two Where coditions can be used at a time to one variable
Two IF conditions can not be used at a time to one variable

In Where condition either <= OR =< can be used
In If condition only <= can be used.

'where' is Data set options and statement
'If' is only Statement

Is This Answer Correct ?    0 Yes 10 No

Post New Answer

More SAS Interview Questions

what are the three main credit bureau names

1 Answers   Synchrony Financial,


Give e an example of..

0 Answers  


Describe crosslist option in tables statement?

0 Answers  


data voter; input Age Party : $1. (Ques1-Ques4)($1. + 1); datalines; 23 D 1 1 2 2 45 R 5 5 4 1 67 D 2 4 3 3 39 R 4 4 4 4 19 D 2 1 2 1 75 D 3 3 2 3 57 R 4 3 4 4 ; Idont understand what the (Ques1-Ques4)($1. + 1) means. I have seen (Ques1-Ques4)(4*$1.), but what is (Ques1-Ques4)($1. + 1)? Appreciate all help Thanks

3 Answers  


what are methods to identify duplicate observations?

5 Answers   HCL,






calculate the sum of value using only DATA STEP. data count_; input year name $ value; cards; 2006 xxx 10 2007 yyy 12 2006 xxx 20 2008 yyy 15 2007 xxx 15 ; out put should be like this year name T_value ----------------------- 2006 xxx 30 2007 xxx 15 2007 yyy 12 2008 xxx 15

6 Answers  


what do the pad and dim functions do? : Sas programming

0 Answers  


I have 2 data sets A & B. Both have a variable called Age in them, each of them specifying a different functionality. In my program I use bot these data sets. How do I specify which Age variable I want to use?

6 Answers  


What is SAS? is it a software just for use or we can creat something over there?

5 Answers   Cognizant,


what is SAS OPTIMIZATION?

0 Answers  


what is study design in while working with SAS? what are screening variables in SAS?

0 Answers   MSCR,


1.we can execute a macro with in a macro,by using call symput and symget can any one give me one example? 2.We can create the macro variables by using %let,%do,macro parameters,INTO clause in proc sql and call symput, can any one give me example to create macro variable with INTO clause and call symput? 3.

1 Answers  


Categories