Chapter Contents

Previous

Next
The PRINTTO Procedure

Example 2: Routing to SAS Catalog Entries


Procedure features:
PRINTTO statement:
Without options
Options:
LABEL=
LOG=
NEW
PRINT=

This example uses PROC PRINTTO to route the SAS log and procedure output to a SAS catalog entry and then to reset both destinations to the default.


Program

libname lib1 'SAS-data-library';

options nodate pageno=1 linesize=80 pagesize=60 source;
 Note about code
proc printto log=test.log label='Inventory program' new;
run;





 Note about code
data lib1.inventry;
   length Dept $ 4 Item $ 6 Season $ 6 Year 4;
   input dept item season year @@;
   datalines;
3070 20410  spring 1996 3070 20411  spring 1997
3070 20412  spring 1997 3070 20413  spring 1997
3070 20414  spring 1996 3070 20416  spring 1995
3071 20500  spring 1994 3071 20501  spring 1995
3071 20502  spring 1996 3071 20503  spring 1996
3071 20505  spring 1994 3071 20506  spring 1994
3071 20507  spring 1994 3071 20424  spring 1994
;
 Note about code
proc printto print=lib1.cat1.inventry.output
             label='Inventory program' new;
run;

proc report data=lib1.inventry nowindows headskip;
   column dept item season year;
   title 'Current Inventory Listing';
run;
 Note about code
proc printto;
run;


Log
SAS Log Routed to SAS Catalog Entry SASUSER.PROFILE.TEST.LOG.
 Note about figure
8
9    data lib1.inventry;
10      length Dept $ 4 Item $ 6 Season $ 6 Year 4;
11      input dept item season year @@;
12      datalines;

NOTE: SAS went to a new line when INPUT statement reached past the end of a
      line.
NOTE: The data set LIB1.INVENTRY has 14 observations and 4 variables.
NOTE: DATA statement used:
      real time           0.00 seconds
      cpu time            0.00 seconds


20   ;
21
22   proc printto print=lib1.cat1.inventry.output
23      label='Inventory program' new;
24   run;

NOTE: PROCEDURE PRINTTO used:
      real time           0.00 seconds
      cpu time            0.00 seconds


25
26   proc report data=lib1.inventry nowindows headskip;
27      column dept item season year;
28      title 'Current Inventory Listing';
29   run;

NOTE: PROCEDURE REPORT used:
      real time           0.00 seconds
      cpu time            0.00 seconds


30
31   proc printto;
32   run;


Output
Procedure Output Routed to SAS Catalog Entry LIB1.CAT1.INVENTRY.OUTPUT.
 Note about figure
                           Current Inventory Listing                           1

                        Dept  Item    Season       Year

                        3070  20410   spring       1996
                        3070  20411   spring       1997
                        3070  20412   spring       1997
                        3070  20413   spring       1997
                        3070  20414   spring       1996
                        3070  20416   spring       1995
                        3071  20500   spring       1994
                        3071  20501   spring       1995
                        3071  20502   spring       1996
                        3071  20503   spring       1996
                        3071  20505   spring       1994
                        3071  20506   spring       1994
                        3071  20507   spring       1994
                        3071  20424   spring       1994


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.