Pages

Thursday, August 1, 2013

Widgets

Choosing the Most Efficient Procedure

There’s often several ways to accomplish the same task with SAS. The question is, are there any guidelines to determine the most efficient method?

It’s impossible to say with certainty that one method or procedure is always more efficient than another because it usually depends on several factors unique to each installation.

But there are a few general guidelines to follow: Procedures designed to perform one specific task are usually more efficient than multi-purpose procedures.

For example, you can use PROC PRINT or PROC SQL to print out a dataset:
proc print data=work.enroll;
run;

proc sql;
select *
from work.enroll;

Since PROC PRINT is specifically designed for printing, it is usually more efficient than using PROC SQL for that purpose.

The Important Exception: PROC DATASETS PROC DATASETS is a utility procedure for managing SAS files that can be used to:
• Copy SAS files from one SAS library to another
• Rename, repair, append or delete SAS files
• List the SAS files in a SAS library
• List the attributes of a SAS dataset
• Manipulate passwords
• Modify dataset attributes
• Modify variables in SAS datasets
• Create and delete indexes
• Create and manage audit files
• Create and delete integrity constraints

Even though PROC DATASETS is a multi-purpose procedure, it tends to be more efficient than using a data step to change dataset attributes, because PROC DATASETS does not process the data portion of the dataset - just the data attributes. Since the data isn’t read in, the amount of time saved when changing dataset attributes on large datasets can be significant.

No comments:

Post a Comment