Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SAS: how to put the report into a file ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Tue Nov 17, 2009 4:22 pm    Post subject: SAS: how to put the report into a file ?
Reply with quote

Hi ALL,

I have created a SAS report in spool. I need to put this report into a flat file. Can somebody help me on this ? What statement I should add to specify my file ? I have gone thru some SAS guide and found FILENAME and PUT can be used. I tried this but no luck. can someone please give me a hint on this ?

I have used the following code to create the report in spool.

DATA TEST;
INFILE IN;
INPUT
@4 ID $CHAR4.
@45 DEPT $CHAR3.
@100 CODE $CHAR4.
;
PROC PRINT DATA=TEST UNIFORM;
TITLE 'TEST OUTPUT: ';
FOOTNOTE1 '* TEST RUN *'
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 17, 2009 4:40 pm    Post subject:
Reply with quote

PROC PRINTTO is one possibility.

Generally, if I expect a report to need to go to a file I will not use PROC PRINT but write my own report using DATA _NULL_; so I can specify the file name via a FILE statement. This also gives me much more control over the format of the report.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2445
Location: Netherlands, Amstelveen

PostPosted: Tue Nov 17, 2009 5:11 pm    Post subject:
Reply with quote

PROC PRINTTO Statement i also had in mind.
Some other solutions are :

PROC REPORT
PUT statements with formatting (and yes Robert that is with a null dataset, and a file statement)

There are some nice SAS manuals describing all methods.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 17, 2009 5:16 pm    Post subject:
Reply with quote

You could also use ODS (Output Delivery System) these days but ODS can get very complex depending on what you're wanting to do.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Nov 18, 2009 1:10 am    Post subject: Reply to: SAS: how to put the report into a file ?
Reply with quote

A PROC PRINT writes to the SASLIST dataset. If you want the report in a flat file, you would direct SASLIST to a permanent file:

Code:

//SAS.SASLIST  DD DSN=HLQ.SASLIST.OUTPUT,                       
//    UNIT=SYSDA,DISP=(NEW,CATLG),                       
//    SPACE=(TRK,(20,10),RLSE)                         


If you want just the records in the flat file, you need to add a DD statement like:

Code:

//SAS.OUTFILE DD DSN=HLQ.OUTPUT.FILE,
//        UNIT=SYSDA,DISP=(,CATLG),                       
//        RECFM=FB,LRECL=14,BLKSIZE=27986,                 
//        SPACE=(TRK,(20,20),RLSE)                       


Then add a step to your SAS program to write to OUTFILE.

Code:

  DATA _NULL_;                         
     SET TEST;                       
     FILE OUTFILE;                   
     PUT  @01 ID    $CHAR4.
             @05 ' '
             @06 DEPT $CHAR3.
             @09 ' '
             @10 CODE $CHAR4.;
 
Back to top
View user's profile Send private message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Wed Nov 18, 2009 5:45 pm    Post subject:
Reply with quote

cpuhawg,

SAS.OUTFILE is not a DD name in my SAS proc.

Thanks
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8620
Location: Back in jolly old England

PostPosted: Wed Nov 18, 2009 5:48 pm    Post subject:
Reply with quote

sparrow wrote:
cpuhawg,
SAS.OUTFILE is not a DD name in my SAS proc.
Thanks

I believe that he is merely giving examples of how it may be done.
Just because he chooses a DD name that is not in your SAS proc does not stop you from following his examples and adding it ................. does it
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Wed Nov 18, 2009 6:09 pm    Post subject: Reply to: SAS: how to put the report into a file ?
Reply with quote

Quote:
SAS.OUTFILE is not a DD name in my SAS proc.


people around here are so eager to be spoon fed that do not even try to understand the concept
even reading a whole post looks consuming

maybe because the price for neuron maintenance is getting higher and highe nowadays icon_lol.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 18, 2009 6:24 pm    Post subject:
Reply with quote

cpuhawg, the drawback to redirecting SASLIST is all output for the SAS step will be redirected -- not just the report. If there are other procedures being done in the step, SASLIST would also include their output.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us