BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
paul8
Fluorite | Level 6

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

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 ;

 

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

Your code does not show any ODS RTF

 

I find the description of the problem very difficult to understand. Please explain in more detail.

--
Paige Miller
paul8
Fluorite | Level 6

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;

Quentin
Super User

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.

paul8
Fluorite | Level 6
Ods exclude all; stops the image from saving
Quentin
Super User

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 ;

 

Ksharp
Super User
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;
paul8
Fluorite | Level 6

Thank you all for the replies.

Ods rtf exclude all; has done the trick for me

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1413 views
  • 4 likes
  • 4 in conversation