Saturday, October 30, 2010

SAS - Efficiency

Some SAS recommendations for making the code more efficient.
  • Avoid necessary DATA steps.
  • IF statements before loading raw data.
  • Use of WHERE statements in procedures.
  • Drop unnecessary variables by using KEEP/DROP.
  • Optimize size of variables using LENGTH.
  • Use of IF-THEN-ELSE statements when possible instead of an IF-THEN sequence.
  • Order of conditions inside the statements. The most frequent case should be the first.
  • Multiple OR operators instead of IN.
  • Use of DATA _NULL_ when creating Reports.
  • Use of permanent data sets in libraries.
  • use of PROC DATASETS to modify variables, instead of DATA statements.
  • PROC APPEND to join similar datasets.
  • Use RETAIN statement to initialize contents
  • Avoid unnecessary sorts: two-level sort instead of one-level sort and a two-level sort.
  • Sort only what we have to sort
  • Sort: Using NOEQUALS if we do not neet the relative order.

No comments:

Post a Comment