In the SAS Data step what is the difference between the
subsetting done by Where and subsetting done by If?
Answer Posted / 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 |
Post New Answer View All Answers
what techniques and/or procs do you use for tables? : Sas programming
how will you locate the sas platform applications? : Sas-bi
What do you know about sas and what we do? : sas-grid-administration
what are several options for creating reports in web report studio? : Sas-bi
Explain why double trailing @@ is used in input statement?
What are the data types that sas contain?
how can you put a "trace" in your program? : Sas programming
What is the difference between proportion and average?
Tell me more about the parameters in macro? : sas-macro
how to do user inputs and command line arguments in sas?
for what purpose would you use the retain statement? : Sas programming
explain about sas business intelligence? : Sas-bi
What is the use of divide function?
how would you create a data set with 1 observation and 30 variables from a data set with 30 observations and 1 variable? : Sas programming
In ARRAY processing, what does the DIM function do?