As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
WHERE vs IF Statements
WHERE vs. IF Statements: Knowing the Difference in How and When to Apply
View Presentation Now: WHERE vs. IF Statements 
Sunil Gupta, Sunil.Gupta@Quintiles.com
- CDISC for Medical Device Team (Industry Expert)
- Subject Matter Expert for Edit Check Design Principles Chapter in Good Clinical Data Management Practices (GCDMP)
More classes, articles and books by Sunil Gupta.
SAS User Quote
"The first paper I read from you was " When do I use a WHERE statement vs. an IF statement to subset a data set?" That paper clarified my understanding to differentiate two terms and helped solve the problem at work. All the papers written by you are very helpful and easy to understand. Thank you and Keep up the good work."
Leena Vaidya, SAS Programmer at New York University
"Actually I read few of your papers, they were very informative and cleared many doubts, especially one with the where and if statement usage then I visited your website which was very helpful for references."
Sonal Gupta, SAS Programmer
When programming in SAS, there is almost always more than one way to accomplish a task. Beginning programmers may think that there is no difference between using the WHERE statement and the IF statement to subset your data set. Knowledgeable programmers know that depending on the situation, sometimes one statement is more appropriate than the other. For example, if your subset condition includes automatic variables or new variables created within the DATA step, then you must use the IF statement instead of the WHERE statement. This paper shows you how and when to apply the WHERE and IF statements to get correct and reliable results. It also reviews the similarities as well as the differences between these two SAS programming approaches. Note that this paper does not focus on comparing the performance differences between the WHERE and IF statements.
Download Summary Sheet, SAS Paper and Technical Tip
- Download all Sunil Gupta's SAS conference papers, presentations and hands-on workshops 
More information on Sharpening Your SAS Skills.