Help using Base SAS procedures

? Proc Print output to png or similarly useful format for cut/paste into MS-Word

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

? Proc Print output to png or similarly useful format for cut/paste into MS-Word

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:


Attachment

Accepted Solutions
Solution
‎04-15-2015 03:32 PM
Super User
Posts: 10,497

Re: ? Proc Print output to png or similarly useful format for cut/paste into MS-Word

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


All Replies
Solution
‎04-15-2015 03:32 PM
Super User
Posts: 10,497

Re: ? Proc Print output to png or similarly useful format for cut/paste into MS-Word

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.

Contributor
Posts: 22

Re: ? Proc Print output to png or similarly useful format for cut/paste into MS-Word

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 192 views
  • 0 likes
  • 2 in conversation