Data visualization with SAS programming

2 png graphs are output when only 1 was expected.

Accepted Solution Solved
Reply
Occasional Contributor JGS
Occasional Contributor
Posts: 7
Accepted Solution

2 png graphs are output when only 1 was expected.

Version 9.4 (TS1M3)

Windows 10 64os

 

Hello: 

The output from prg. gives me 2 graphs .

One is sgplot.png and the 2nd is ods html file.png.

I am thinking that I should be just getting one graph.

Not sure why 2 graphs are being produces.

I would like to keep only the html file and I would like not to have to 

use the delete key for the other.

 

Thanks for you help.

 

 

ods listing close ;
ods graphics on /
width = 6.4 in
height = 4.8 in
imagefmt = png
imagemap = on
border = no
;
ods html file = "ChgDIABPvsbaseDia-base.png"
style = journal
path = 'C:\ProjectName\sasout\png\' 
image_dpi = 96 ;

Title1 font = 'Arial' H = 1.5 j=c "Figure 2.4 " ;
Title2 font = 'Arial' H = 1.5 j=c "Test 1" ;
Title3 font='Arial' H = 1.5 j=c "Change vs. Base" ;


proc sgplot data = ad2A noautolegend ;
where avisitn = -1 ;
scatter y = chgdia x = basedia /
markerattrs=(symbol=circlefilled size = 4 pt color = blue) ;
yaxis label = "Chg. Diastolic BP (mmHg) " values = (-20 to 20 by 10 ) ;
xaxis label = "Baseline Diastolic BP (mmHg)" values = (60 to 100 by 10) ;

run ;
ods graphics off ;

ods listing ;

 

Log output:

4120 ods graphics off ;
4121
4122 
4123 ods listing close ;
4124 ods graphics on /
4125 width = 6.4 in
4126 height = 4.8 in
4127 imagefmt = png
4128 imagemap = on
4129 border = no
4130 ;
4131 ods html file = "ChgDiaBPvsbasedia-wk12.png"
The SAS System

4132 style = journal
4133 path = 'C:\Projects\sasout\png\'
4134 image_dpi = 96 ;
NOTE: Writing HTML Body file: ChgDiaBPvsbasedia-wk12.png
4135
4136 Title1 font = 'Arial' H = 1.5 j=c "Figure 2.6 " ;
4137 Title2 font = 'Arial' H = 1.5 j=c " Test1" ;
4138 Title3 font='Arial' H = 1.5 j=c "Change Diastolic Mean BP vs. Base BP at Week 12" ;
4139 proc sgplot data = ad2A noautolegend ;
4140 where avisitn = 16 ;
4141 scatter y = chgdia x = basedia /
4142 markerattrs=(symbol=circlefilled size = 4 pt color = blue) ;
4143 yaxis label = "Chg. Diastolic BP (mmHg) " values = (-20 to 20 by 10 ) ;
4144 xaxis label = "Baseline Dialstolic BP (mmHg)" values = (60 to 100 by 10) ;
4145
4146 run ;

NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.26 seconds
cpu time 0.06 seconds

NOTE: There were 109 observations read from the data set WORK.ADZA2A.
WHERE avisitn=16;

4147 ods graphics off ;


Accepted Solutions
Solution
‎10-05-2016 02:22 PM
SAS Super FREQ
Posts: 925

Re: 2 png graphs are output when only 1 was expected.

This:

 

ods html file = "ChgDIABPvsbaseDia-base.png"

 

Creates an HTML file with a .png extension, not a PNG file. Change the extension to ".html". The sgplot.png is the real image file. If you want to change the image file name, use the following:

 

ods graphics / imagename="whatever";  /* Do NOT put an extension on "whatever". The correct extension will be added */

 

You can also add RESET=INDEX to reset the filename indexing and allow image files to be overwritten:

 

ods graphics / reset=index imagename="whatever"; 

 

Hope this helps!

Dan

 

View solution in original post


All Replies
Solution
‎10-05-2016 02:22 PM
SAS Super FREQ
Posts: 925

Re: 2 png graphs are output when only 1 was expected.

This:

 

ods html file = "ChgDIABPvsbaseDia-base.png"

 

Creates an HTML file with a .png extension, not a PNG file. Change the extension to ".html". The sgplot.png is the real image file. If you want to change the image file name, use the following:

 

ods graphics / imagename="whatever";  /* Do NOT put an extension on "whatever". The correct extension will be added */

 

You can also add RESET=INDEX to reset the filename indexing and allow image files to be overwritten:

 

ods graphics / reset=index imagename="whatever"; 

 

Hope this helps!

Dan

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 193 views
  • 0 likes
  • 2 in conversation