Previous Page | Next Page

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

 Note about code
options nodate pageno=1 linesize=80 pagesize=60 source;
 Note about code
libname lib1 'SAS-library';
 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 2006 3070 20411  spring 2007
3070 20412  spring 2007 3070 20413  spring 2007
3070 20414  spring 2006 3070 20416  spring 2005
3071 20500  spring 2006 3071 20501  spring 2005
3071 20502  spring 2006 3071 20503  spring 2006
3071 20505  spring 2005 3071 20506  spring 2005
3071 20507  spring 2004 3071 20424  spring 2006
;
 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
NOTE: PROCEDURE PRINTTO used (Total process time):                                  
      real time           0.07 seconds                                              
      cpu time            0.01 seconds                                              
                                                                                    
                                                                                    

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       2006
                        3070  20411   spring       2007
                        3070  20412   spring       2007
                        3070  20413   spring       2007
                        3070  20414   spring       2006
                        3070  20416   spring       2005
                        3071  20500   spring       2006
                        3071  20501   spring       2005
                        3071  20502   spring       2006
                        3071  20503   spring       2006
                        3071  20505   spring       2005
                        3071  20506   spring       2005
                        3071  20507   spring       2004
                        3071  20424   spring       2006

Previous Page | Next Page | Top of Page