Include generated SAS code
Many macro procedures can be replaced by including the SAS code with macro variables instead of calling a macro procedure. The advantage of using SAS code over calling a macro procedure is the description of events saved in the SAS log. This log is critical to debug and verify the successful completion of the program. The Include statement "SOURCE2 parameter" will list in the SAS log the included code. Macros generate different information, if any, in the SAS log. Debugging macros takes additional techniques
P/C Example: A folder should be allocated to store the codes to be included.
- %INCLUDE "C:\SAS_CODE_DIRECTORY\SELECTED_SASCODE.sas" ;
UNIX Example: A directory should be allocated to store the codes to be included.
- %INCLUDE "/SAS_CODE_DIRECTORY/SELECTED_SASCODE.sas" ;
MVS Example: A PDS should be allocated to store the codes to be included.
- //JOB CARD
- //STEP01 EXEC SASPROD
- //SASCODE DD DSN=NODE1.NODE2.SAS_CODE_PDS,DISP=SHR
- //SYSIN DD *
- %INCLUDE SASCODE(SELECTED_CODE)/SOURCE2;