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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 1 reply
  • 1537 views
  • 0 likes
  • 2 in conversation