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.
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;
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;
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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.