Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 7931
Location: Bellevue, IA

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: 2422
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: 7931
Location: Bellevue, IA

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: 8593
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: 10210
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: 7931
Location: Bellevue, IA

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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us