July 2006 Technical Tip Sending SAS reports to a PDS (mainframe SAS)

The scenario is as follows: your client requires many reports, all of which are produced over some period of time. Maybe some of these reports will need to be recreated as customer requirements are changed or clarified. How can you keep these reports in an organized fashion, and always be sure you are looking at the latest version of each report? My solution is two-fold. First, use PROC PRINTTO to send the reports to a file, and second, store those reports in a partitioned dataset (PDS).

//* JOBCARD HERE
//STEP010 EXEC SAS 
//REPORT1  DD DSN=U0290.REPORTS(REPORT1),DISP=SHR 
//REPORT2  DD DSN=U0290.REPORTS(REPORT2),DISP=SHR 
//REPORT3  DD DSN=U0290.REPORTS(REPORT3),DISP=SHR 
//SYSIN    DD * 
OPTIONS LS=80; 

DATA KIDS; 
LENGTH NAME $10;
LENGTH GENDER $1;
INPUT NAME $ AGE GENDER $; 
DATALINES; 
CORA 21 F 
EMMA 15 F 
HANNAH 17 F 
WILLIAM 23 M 
; 

PROC PRINTTO FILE=REPORT1 NEW; 
OPTIONS PAGENO=1; 
TITLE 'GIRLS'; 
PROC PRINT DATA=KIDS; 
WHERE GENDER = 'F'; 
RUN;

PROC PRINTTO FILE=REPORT2 NEW; 
OPTIONS PAGENO=1; 
TITLE 'HOW MANY OF EACH'; 
PROC FREQ DATA=KIDS; 
TABLES GENDER; 
RUN;

PROC PRINTTO FILE=REPORT3 NEW; 
OPTIONS PAGENO=1; 
TITLE 'STATS'; 
PROC MEANS DATA=KIDS; 
RUN; 

Comments:

  • The partitioned dataset was allocated using ISPF panel 3.2 with RECFM=FBA and LRECL=133.
  • Use of the keyword NEW is required when sending PROC PRINTTO output to a member of a PDS.
  • A permissive delete (such as with IEFBR14 or IDCAMS) is not required when writing to a member of an existing PDS. If the member does not exist, then it is created. If the member does exist, then it is replaced.
  • This example shows three reports being created in a single job. This is not required: the techniques shown here will work with multiple jobs.
  • Use of OPTIONS PAGENO=1 is recommended when creating multiple reports within the same job, otherwise page numbering will continue across reports.

We hope you will consider Caliber Data Training when you are in need of high quality SAS training.


Go to the articles index. Written by Bill Qualls. Copyright © 2006 by Caliber Data Training 800.938.1222