Data visualization with SAS programming

PROC SGPLOT with PROC GSLIDE

Reply
Frequent Contributor
Posts: 84

PROC SGPLOT with PROC GSLIDE

I am trying to use PROC GSLIDE to create a GSEG entry for a SGPLOT so that I can use PROC GREPLAY to combine multiple charts into one HTML output.  The SGPLOT is created and works just fine, but when I run the GSLIDE step, it seems to skew the aspect ratio of the SGPLOT to a point where it's not readable.  I have also tried using the iBack method with the same result.  It appears the GSLIDE resizes the SGPLOT somehow, but I don't understand how to control that option.  Any help is appreaciated.

 

ods graphics on / reset=index imagename="Myplot";
ods HTML
file="TestChart.html" 
path="&odsout.";   

goptions hsize=4in vsize=2in;
goptions xpixels=900 ypixels=900;
goptions device=png;

proc sgplot data = Trend_Final;
     series x = trend  y = cRound / datalabel = trend  legendlabel = "Work"  lineattrs = (thickness = 2  pattern = solid  color = BLACK);
     yaxis label = "Scheduled"  grid  values = (200 to 400 by 50)  offsetmin = 0.05  offsetmax = 0.05;
     xaxis label = " Date"  grid  offsetmin = 0.05  offsetmax = 0.05;
 
run;

ODS HTML CLOSE;
ODS LISTING;

data CreatedAnno;
xsys='3'; ysys='3'; hsys='3'; when='a';
function='image'; x=100; y=100; imgpath="&odsout.Myplot1.png"; style='fit'; output;
run;

title;
footnote;
proc gslide name="TVol" anno= CreatedAnno;
run;
SAS Employee
Posts: 963

Re: PROC SGPLOT with PROC GSLIDE

Sounds like the size of the sgplot image you're annotating into the gslide isn't matching up, and is getting stretched out of proportion.

 

You'll either need to make the gslide the same size as the sgplot, or make the sgplot the same size as the gslide.

 

I think you can control the size of the sgplot using something like ...

 

   ods graphics on / imagefmt=staticmap imagename="somename" height=4in width=4in;

 

Frequent Contributor
Posts: 84

Re: PROC SGPLOT with PROC GSLIDE

Thank you for the reply Dr. Allison, that is exactly what I was thinking as well, but I don't see an option to control the size of the GSLIDE output.  I set the size of the .PNG file output in the ODS HTML statement and the output appears just fine (i.e. not distorted) but the GSLIDE statement produces the distorted output.  Is there a default size for the GSLIDE output?  The X/Y statement in the annotate statement don't seem to have any effect on the distortion, just the size ratio of the chart.

Grand Advisor
Posts: 9,681

Re: PROC SGPLOT with PROC GSLIDE

Since the output is going to HTML I would recommend looking into ODS tagsets.htmlpanel. That allows for describing the area of the document that your graphs or tables are going to display and keeps aspect ratios and text in a more useable appearance than the GSEG approach.

Frequent Contributor
Posts: 84

Re: PROC SGPLOT with PROC GSLIDE

I've tried moving my code to use tagsets.htmlpanel, but I can't get that tagset to compile any charts.

 

I started with the example here:http://support.sas.com/kb/38/066.html, but even running just the code provided, I consistently get an "ERROR: No body file. TAGSETS.HTMLPANEL output will not be created." message.

 

I am on a linux grid environment, but I can still run ODS HTML statements, provided I include a file= and path= statement.

Post a Question
Discussion Stats
  • 4 replies
  • 383 views
  • 0 likes
  • 3 in conversation