DATA Step, Macro, Functions and more

ODS html or rtf

Reply
Super Contributor
Posts: 673

ODS html or rtf

Hi,

  I have a word document that has report of output tables. But how to add the dataset contents to the word document.i.e

say i have this document report.doc and i would like to add the sas datasets in the report (each data set has less than 10 records) using the ods html or rtf.

ods html;

  title 'xxxxx';

proc print data=libname.dsn;

run;

ods close;

ods html;

  title zzzz;

proc print data=libname.dsn1;

run;

ods close;

The above two datasets are to be shown in the report.Plus when I use html it will occupy more than the width of the word document page.

Super User
Posts: 11,343

Re: ODS html or rtf

Sandwich all of you output calls within a single pair of ODS statements. If you want Word output then RTF or tagsets.RTF is probably best. These will both produce output that breaks relatively nicely for printing.

Ods rtf file="c:\reports\myreport.rtf" style= <your preferred style>;  /*use your path of choice and there are a variety of options bodytitle keepn are likely to consider. I don't like the default style used for RTF */

<output procedures or ODS TEXT= statements>

ods rtf close;

SAS Super FREQ
Posts: 8,868

Re: ODS html or rtf

Hi:

  And in addition to the suggestion of using ODS RTF or ODS TAGSETS.RTF, you can change orientation, margins and page numbering for your display of the datasets. So if the display of the data is wider than the default portrait orientation, you can change the orientation to landscape.

cynthia

options orientation=landscape nodate number

        pageno=1

        topmargin=.25in bottommargin=.25in

        rightmargin=.25in leftmargin=.25in;

       

ods rtf file='c:\temp\two_dsn.rtf' style=journal;

  title 'xxxxx';

  proc print data=libname.dsn;

  run;

        

  proc print data=libname.dsn1;

  title 'zzzz';

  run;

     

ods rtf close;

Super Contributor
Posts: 673

Re: ODS html or rtf

Posted in reply to Cynthia_sas

Thanks Cynthia.But how to display the proc print contents of data sets dsn and dsn1 to an already existing word document in c:\temp?I.e say I have a word document called report.doc in c:\temp and i would like to print the datasets to that word doc.

Ask a Question
Discussion stats
  • 3 replies
  • 236 views
  • 0 likes
  • 3 in conversation