A DATA step is normally compiled when it is executed. You can, however, compile a DATA step and save it for later use. This would enable it to run faster than a normal DATA step. For WPS, the DATA step is compiled and stored in a file with the extension .wpdpgm. This kind of DATA step is called a stored compiled DATA step.
To create a stored compiled DATA step, you specify the /PGM option of the DATA statement. For example:
LIBNAME temp 'c:\temp'; LIBNAME dsloc 'c:\ds'; DATA out1 /PGM=temp.mycmppg; set dsloc.myin; input var1 $ var2 $; RUN;
This creates a stored compiled DATA step mycmppg.wpdpgm in the library temp. When executed, the stored compiled DATA step will read from the dataset myin in the library dsloc and write to the dataset out1 in the work library. This DATA step does not read and write to the specified datasets; it only creates the stored compiled DATA step.
To subsequently run the stored compiled DATA step, you use the PGM option of the DATA statement. There is now no forward slash on the option:
LIBNAME temp 'c:\temp'; LIBNAME dsloc 'c\ds';
DATA PGM=temp.mycmppg;
RUN;
The LIBNAME statements are used to create the library references for the location of the stored compiled dataset and for the library references used in the step.
You cannot run a .wpdpgm file directly from the command line or from Workbench; it must be run using a DATA step. The DATA step that is used to run a stored compiled DATA step can only contain the following statements:
- EXECUTE, which executes the stored compiled DATA step, and is included in the step by default if you specify the PGM option.
- REDIRECT, which is used to change the source or destination data files.
- DESCRIBE, which lists the statements in the stored compiled DATA step in the log.
Any other statements cause an error. For information on these three statements, see the WPS Reference for Language Elements.
Comments
0 comments
Article is closed for comments.