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 is the purpose of _error_? : Sas programming
How would you identify a macro variable?
how do you debug and test your sas programs? : Sas programming
explain what is data set in sas? : Sas-administrator
Do you need to compute new variables? If so,should you do this before you execute the report-writing procedure?
How do you convert basic cube to transaction cube and transaction cube to basic cube?
what are some problems you might encounter in processing missing values? In data steps? Arithmetic? Comparisons? Functions? Classifying data? : Sas programming
How would you identify a macro variable? : sas-macro
What are the difference between sas functions and procedures?
hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?
name some data transformation used in sas di? : Sas-di
how do you want missing values handled? : Sas programming
Mention what is SAS data set?
What is the basic syntax style in SAS?
How do dates work in SAS data?