IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SAS: how to put the report into a file ?


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 17, 2009 4:40 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Nov 17, 2009 5:11 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 17, 2009 5:16 pm
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
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
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: 8797
Location: Welsh Wales

PostPosted: Wed Nov 18, 2009 5:48 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Nov 18, 2009 6:09 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 18, 2009 6:24 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top