I have an proc sgplot within my ods rtf code which is later used within proc report. I don't want the chart to print into the ods at this stage. If I ods exclude all; it doesn't save the chart. If I do ods close then ods rtf file='same location' it only saves data from the second ods rtf file=;
ods exclude all;
ods listing gpath="&loc." style=htmlblue image_dpi=300;
ods graphics / width=3in height=3in reset=index noborder imagename='data' outputfmt=png;
proc sgplot data = x;
run;
title;
ods exclude none;
But did you try :
ods RTF exclude all ;
?
That should exclude everything from the RTF file, but still send the graph to the listing destination.
As an example, if I run below, SGPLOT writes the graph to a .png file because the listing destination is open, but does not write the graph to the RTF file.
ods listing ;
ods rtf file="Q:\junk\foo.rtf" ;
ods rtf exclude all ;
proc sgplot data=sashelp.class ;
scatter x=height y=weight ;
run ;
ods rtf exclude none ;
proc print data=sashelp.class ;
run ;
ods rtf close ;
Your code does not show any ODS RTF
I find the description of the problem very difficult to understand. Please explain in more detail.
I have a massive lot of code within ods rtf. This is just a section. I don't want image to print when running proc sqplot step. Ods exclude doesn't work. Multiple ods close didn't work as not all the data went to the rtf file.
Ods rtf file=... ;
/*loads of code*/
/*Creating an chart and saving it*/
/*issue: I don't want it to print image to ods rtf. ods exclude all; stops it printing to ods but stops image saving*/
ods listing gpath="&loc." style=htmlblue image_dpi=300;
ods graphics / width=3in height=3in reset=index noborder imagename='data' outputfmt=png;
proc sgplot data = x;
/*more code*/
run;
/*image is then used in proc report. This is why I don't want it to print above*/
proc report data=x ;
column x column;
define x/display ''
style(column)={ preimage="&path\chart.png" bordertopcolor=white borderbottomcolor=white borderrightcolor=white borderleftcolor=white}
style(header)={ cellwidth=20% bordertopcolor=white borderbottomcolor=white borderrightcolor=white borderleftcolor=white};
/*more code*/
endcomp;
run;
Did you try
ods rtf exclude all;
?
I think that might work. Sounds like you want SGPLOT to write the graph to the listing destination, you just don't want to write it to the RTF destination.
But did you try :
ods RTF exclude all ;
?
That should exclude everything from the RTF file, but still send the graph to the listing destination.
As an example, if I run below, SGPLOT writes the graph to a .png file because the listing destination is open, but does not write the graph to the RTF file.
ods listing ;
ods rtf file="Q:\junk\foo.rtf" ;
ods rtf exclude all ;
proc sgplot data=sashelp.class ;
scatter x=height y=weight ;
run ;
ods rtf exclude none ;
proc print data=sashelp.class ;
run ;
ods rtf close ;
ods _all_ close; ods listing gpath="&loc." style=htmlblue image_dpi=300; ods graphics / width=3in height=3in reset=index noborder imagename='data' outputfmt=png; proc sgplot data = x; run; title;
Thank you all for the replies.
Ods rtf exclude all; has done the trick for me
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.