Friday, June 3, 2011

Route SAS log and procedure ouput using PROC PRINTTO

PROC PRINTTO is very useful when we try to automate the debugging process of SAS program.

LABEL= provide a description for a SAS log or procedure output stored in a SAS catalog entry
LOG= route the SAS log to a permanent external file or SAS catalog entry
LOG= and PRINT= with same destination combine the SAS log and procedure output into a single file
NEW= replace the file instead of appending to it
PRINT= route procedure output to a permanent external file or SAS catalog entry

Using a PROC PRINTTO statement with no options closes any files opened by a PROC PRINTTO statement points both the SAS log and SAS procedure output to their default destinations.

Example:

options nodate pageno=1 linesize=80 pagesize=60 source;

proc printto log='log-file';
run;

data numbers;
input x y z;
datalines;
14.2 25.2 96.8
10.8 51.6 96.8
9.5 34.2 138.2
8.8 27.6 83.2
11.5 49.4 287.0
6.3 42.0 170.7
;

proc printto print='output-file' new;
run;proc print data=numbers;
title 'Listing of NUMBERS Data Set';
run;

proc printto;
run;

No comments: