BookmarkSubscribeRSS Feed
P5C768
Obsidian | Level 7

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;
4 REPLIES 4
GraphGuy
Meteorite | Level 14

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;

 

P5C768
Obsidian | Level 7

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.

ballardw
Super User

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.

P5C768
Obsidian | Level 7

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 1796 views
  • 0 likes
  • 3 in conversation