Data visualization with SAS programming

Problem with ODS GRAPHICS to png format

Reply
Occasional Learner
Posts: 1

Problem with ODS GRAPHICS to png format

[ Edited ]

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

  

Grand Advisor
Posts: 17,338

Re: Problem with ODS GRPHICS to png format

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 ;

 

Ask a Question
Discussion stats
  • 1 reply
  • 169 views
  • 0 likes
  • 2 in conversation