The SAS Output Delivery System and reporting techniques

Create a text file based on ODS out in a data _null_

Reply
Super Contributor
Posts: 400

Create a text file based on ODS out in a data _null_

Hello, I have a pdf file that i'm working to create using ODS PDF and ODSOUT.  I have part of that working correctly.  I would like to take the same out that I have for the pdf and just point it to a text file.  Is this possible with ODS or do I have to go through putting put statements and spacing the data out? Thank you

Super User
Posts: 19,063

Re: Create a text file based on ODS out in a data _null_

That depends on what you're doing in the ODS PDF and what you mean by a text file.

Text files generally have no formatting, so you can look at ODS CSV perhaps. If it was a proc print there may not be any issues.

I'm assuming proc report would have issues, as would any graphical procs. 

You should be able to switch to an RTF file without many changes.

Super Contributor
Posts: 400

Re: Create a text file based on ODS out in a data _null_

Hi Reeza, Thank you for the reply.  I'm using odsout with a data _null_ statement.  So i'm creating a table and rows with my data and it looks good in a pdf file.  I want to show the data in a .txt file with the same spacing between the columns and rows without the formating other then justification.  I can't use RTF even though that works because we have users from all over the world and we have to put the data in the lowest know format so that is a text file for us. Thank you for your help

Super User
Posts: 19,063

Re: Create a text file based on ODS out in a data _null_

Have you tried not using ODS at all then and just pointing to a file instead? You really need to provide a sample of what your code looks like otherwise we're guessing.

data _null_;

file "";

etc...

run;

Super Contributor
Posts: 400

Re: Create a text file based on ODS out in a data _null_

Hi Reeza, here is some test code i'm using to create a pdf file.  How can I use this to create a text file?

ods listing ; title; footnote ;

options orientation=portrait topmargin=1in bottommargin=1in rightmargin=1in leftmargin=1in pageno=1 ;

options nodate nonumber nocenter ;

ods listing close ;

ods escapechar='^' ;

ods pdf file = "c:\temp\temp.pdf" notoc ;

footnote1 j=c height=8pt  font='Courier New' 'Page ^{thispage} of ^{lastpage}' ;

data _null_ ;

    set vinfo ;

    by year ;

    if _n_ = 1 then declare odsout obj() ;

       

    if first.vname then do ;       

        obj.table_start(overrides: 'frame=void rules=none cellpadding=0in cellspacing=.06in ' ) ;

            obj.body_start() ;

                obj.row_start() ;

                    obj.format_cell(text: vlabel, column_span: 2,  overrides: "cellwidth=6.5in backgroundcolor=white just=left fontweight=bold font_face='Courier New' font_size=10pt ") ;                          

                obj.row_end() ;               

    end ;       

   

    if last.vname then do ;       

        obj.body_end() ;

        obj.table_end() ;

    end ;

run ;

ods pdf close ;

SAS Super FREQ
Posts: 8,818

Re: Create a text file based on ODS out in a data _null_


Hi:

  This looks like a few of the previous questions you've posted. https://communities.sas.com/thread/58430 and https://communities.sas.com/thread/57685  Did you ever open a track with Tech Support? I thought you'd contacted them in one of the tracks. What did they tell you about using the new Report Writing Interface and setting up links for PDF? This looks like the same report you were trying to create in those earlier tracks.

cynthia

Super User
Posts: 11,114

Re: Create a text file based on ODS out in a data _null_

And why is the title "Create Text file" when you want a PDF???? PDF is not Text....

Ask a Question
Discussion stats
  • 6 replies
  • 560 views
  • 0 likes
  • 4 in conversation