Working with SAS Data Sets |
Comparison with the SAS DATA Step
If you want to remain in the IML environment and
mimic DATA step processing, you need to learn the
basic differences between IML and the SAS DATA step:
- With SAS/IML software, you start with a
CREATE statement instead of a DATA statement.
You must explicitly set up all your variables with
the correct attributes before you create a data set.
This means that you must define character variables
to have the desired string length beforehand.
Numeric variables are the default, so any variable
not defined as character is assumed to be numeric.
In the DATA step, the variable attributes are
determined from context across the whole step.
- With SAS/IML software, you must use an APPEND
statement to output an observation; in the
DATA step, you either use an OUTPUT statement
or let the DATA step output it automatically.
- With SAS/IML software, you iterate with a DO DATA loop.
In the DATA step, the iterations are implied.
- With SAS/IML software, you have to close the data
set with a CLOSE statement unless you plan to
exit the IML environment with a QUIT statement.
The DATA step closes the data set
automatically at the end of the step.
- The DATA step usually executes faster than IML.
In short, the DATA step treats the problem with
greater simplicity, allowing shorter programs.
However, IML has more flexibility because it is
interactive and has a powerful matrix-handling capability.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.