SUGI30里也有一篇关于if 和where的efficiency的
http://www2.sas.com/proceedings/sugi30/002-30.pdf
Paper 002-30
Efficiency Considerations Using the SAS® System
Rick Langston, SAS Institute Inc., Cary, NC
INTRODUCTION
This paper examines a few of the most common questions regarding efficient SAS code. Its main focus is to
examine CPU usage differences in the areas listed below. Except where noted, all examples were tested on
production versions of SAS on UNIX platforms.
• IF statements versus WHERE statements in DATA steps
• IF statements versus SELECT statements
• PROC SORT versus SQL ORDER BY
• Issues involving DATA step views
• Functions versus arrays versus direct SAS coding
• DATA step stored programs
• Threaded versus non-threaded performance for PROC SUMMARY
• Table lookup comparing PROC FORMAT, merging, and the hash table object
It is important to understand that the real times and CPU times shown in the logs in this paper are not necessarily
indicative of the times you may see if you try the same tests. These times vary greatly between operating systems
and between machine configurations. The times are used here primarily for purposes of comparison to help you to
make decisions on SAS coding practices.