BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8

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.

3 REPLIES 3
ballardw
Super User

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;

Cynthia_sas
SAS Super FREQ

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;

SASPhile
Quartz | Level 8

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 908 views
  • 0 likes
  • 3 in conversation