BookmarkSubscribeRSS Feed
bk1980
Calcite | Level 5

I am trying to use ODS to output a sgrender plot. Able to use ods rtf and outoput an rtf file. I need to outoput a png file as well.

I am running into problems with the png format.

I am not able to get the titles into the png formatted graph. I am only getting the plot. I am using SAS EG (Version 6) to execute my code.

ods _all_ close;

 ods listing gpath = "xxx";

ods graphics on /reset height= 3.25 in

  width = 6.0 in reset imagefmt = png reset imagename = "TEST"

border = off;

 

proc sgrender data =xxx;

title 1 "xxx";

title 2 "yyy";

run;

 

ods graphics off;

 ods listing close;

 

no errors in the log. png output is getting created but just the plot no titles. Any clues? appreciate your help.

 

Thanks

  

1 REPLY 1
Reeza
Super User

Please post your log.

 

Ideally, also post code so we can run your code and replicate your issue. You can use datasets from SASHELP to start off with.

Errors noted in your code so far:

1. Spaces between title and number (Title 1 vs Title1)

2. PROC SGRENDER doesn't seem to have data passed through, hard to say though.

3. Spaces between in and measurement in height/weight statements.

 

Your SGTemplate also needs to account for the title somehow, so you may need changes there.

This generates the graphic, but not in the correct directory so that may not be specified correctly.

 

ods _all_ close;
 ods listing gpath = "C:\_LOCALdata\test.png";
ods graphics on /reset height= 3.25in
  width = 6in reset imagefmt = png reset imagename = "TEST"
border = off;
 
proc sgplot data =sashelp.class;
scatter x=height y=weight;
title1 "xxx";
title2 "yyy";
run;
 
ods graphics off;
 ods listing ;

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 1 reply
  • 1794 views
  • 0 likes
  • 2 in conversation