BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lloydc
Calcite | Level 5

I have been experimenting with ODS statements trying to get the results of a PROC PRINT statement into a file in a format that is easy to cut/paste into an MS-Word document. The RESULTS of the PROC PRINT look perfect for my needs but I'm getting nowhere with writing to a file.

Any suggestions would be appreciated.

A portion of the code (ODS statements, the PROC PRINT) are attached:


1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You have an issue with this part of your code. 1) you have ODS HTML but ODS RTF CLOSE.

So you may not have the latest version actually on disk. 2) the Run; should be before the Close statement.

ods html file='c:\VSP G1000 zHPF\BSAM Elapsed Time.rtf';

proc print data=Work.Elapsed_Time_Report uniform noobs split ='/' blankline=5;

/* by Access_Method;  */

where Access_Method = 'BSAM';

/* pageby Access_Method; */

var __Host_Channels __Ports CPU_Cap zOFF zON timedif Access_Method;

label  __Host_Channels =  '# of Host / Channels'

   __Ports   = '# of Ports'

   CPU_Cap   = 'CPU Service/Cap'

   zOFF   = 'Elapsed Time / zHPF Disabled/ hh:mm'

   zON    = 'Elapsed Time / zHPF Enabled/ hh:mm'

   timedif   = 'Elapsed Time / Reduced/ hh:mm';

ods rtf close;

run;

You don't say quite what is wrong with the output but for a Word destination either ODS RTF or ODS Tagsets.RTF would be best. If you the issue is the appearance such as font size and colors specify a different style on the ODS statement. Otherwise RTF uses a specific style (which I also don't care for). Example

ods RTF file='c:\VSP G1000 zHPF\BSAM Elapsed Time.rtf' style=meadow;

proc print data=Work.Elapsed_Time_Report uniform noobs split ='/' blankline=5;

/* by Access_Method;  */

where Access_Method = 'BSAM';

/* pageby Access_Method; */

var __Host_Channels __Ports CPU_Cap zOFF zON timedif Access_Method;

label  __Host_Channels =  '# of Host / Channels'

   __Ports   = '# of Ports'

   CPU_Cap   = 'CPU Service/Cap'

   zOFF   = 'Elapsed Time / zHPF Disabled/ hh:mm'

   zON    = 'Elapsed Time / zHPF Enabled/ hh:mm'

   timedif   = 'Elapsed Time / Reduced/ hh:mm';

run;

ods rtf close;

Note that with proc print you can also provide specific styles for each variable.

View solution in original post

2 REPLIES 2
ballardw
Super User

You have an issue with this part of your code. 1) you have ODS HTML but ODS RTF CLOSE.

So you may not have the latest version actually on disk. 2) the Run; should be before the Close statement.

ods html file='c:\VSP G1000 zHPF\BSAM Elapsed Time.rtf';

proc print data=Work.Elapsed_Time_Report uniform noobs split ='/' blankline=5;

/* by Access_Method;  */

where Access_Method = 'BSAM';

/* pageby Access_Method; */

var __Host_Channels __Ports CPU_Cap zOFF zON timedif Access_Method;

label  __Host_Channels =  '# of Host / Channels'

   __Ports   = '# of Ports'

   CPU_Cap   = 'CPU Service/Cap'

   zOFF   = 'Elapsed Time / zHPF Disabled/ hh:mm'

   zON    = 'Elapsed Time / zHPF Enabled/ hh:mm'

   timedif   = 'Elapsed Time / Reduced/ hh:mm';

ods rtf close;

run;

You don't say quite what is wrong with the output but for a Word destination either ODS RTF or ODS Tagsets.RTF would be best. If you the issue is the appearance such as font size and colors specify a different style on the ODS statement. Otherwise RTF uses a specific style (which I also don't care for). Example

ods RTF file='c:\VSP G1000 zHPF\BSAM Elapsed Time.rtf' style=meadow;

proc print data=Work.Elapsed_Time_Report uniform noobs split ='/' blankline=5;

/* by Access_Method;  */

where Access_Method = 'BSAM';

/* pageby Access_Method; */

var __Host_Channels __Ports CPU_Cap zOFF zON timedif Access_Method;

label  __Host_Channels =  '# of Host / Channels'

   __Ports   = '# of Ports'

   CPU_Cap   = 'CPU Service/Cap'

   zOFF   = 'Elapsed Time / zHPF Disabled/ hh:mm'

   zON    = 'Elapsed Time / zHPF Enabled/ hh:mm'

   timedif   = 'Elapsed Time / Reduced/ hh:mm';

run;

ods rtf close;

Note that with proc print you can also provide specific styles for each variable.

lloydc
Calcite | Level 5

Thank you, that solution works for me.

Using SAS, I create a lot of plots via GPLOT or SGPLOT and have found that saving them as png files makes inserting into a Word Text Box easiest, with the ability to re-size the graphic much easier and generally sharper looking results. One thing I noticed with this is that the SAS Title isn't part of the table but I can get around that by just using a Word caption.

I've got a time-crunch to deal with, getting it absolutely beautiful isn't very high on the priority list. This works well. Again, thank you.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 977 views
  • 0 likes
  • 2 in conversation