BookmarkSubscribeRSS Feed
data_null__
Jade | Level 19

I want to specify the exact length for each X axis or the overall size of the column panels.  I am trying to make two calls to GRENDER produce a 3 column data panels plots that are compareable. 

9 REPLIES 9
DanH_sas
SAS Super FREQ

Is it the physical axis size or the axis data range that matters for the comparison? If the data range is sufficient, you could determine the min/max for each axis in a datastep, set those values in macro variables, and set the macro variables on the VIEWMIN / VIEWMAX options in the axis options. You could instead use dynamics on these options (for better template reuse) and pass the macro variable values on the DYNAMIC statement in PROC SGRENDER. If you use these values for each call to PROC SGRENDER, you will create comparative panels based on unified data ranges. Let me know if this meets your needs.

Thanks!

Dan

data_null__
Jade | Level 19

Yes, sorry I was not complete in my description, it is the physical length that I want to specify.  I've used GSCALE to produce a TICKVALUESEQUENCE using all data

Because the width of the Y axis labels are different with each call to GRENDER, the Xaxis panels are also slightly different size. 

So I thought if I could specify the X axis length I could have my cake and eat it too.

On a slightly different subject GSCALE seems to use a different algorithm from that used in GTL, same data different ticks .  Do you know if I could make it produce the same Tick Sequence or can I call the GTL function directly.

GraphGuy
Meteorite | Level 14

If there's not a way to do what you're wanting in sgrender, perhaps you could resort to the traditional SAS/Graph Proc Gplot, where you can specify a 'length=' in the axis statement?  Not exactly what you originally asked for, but perhaps a work-around that will let you accomplish the end-goal?

For example, here's some output where I use Gplot, and specify ...

  

axis1 length=2.3in offset=(0,0) order=(0 to 60 by 10) minor=none;

axis2 length=2.3in offset=(0,0) order=(0 to 60 by 10) minor=none;

And then panel the graphs into 3 columns using "ods htmlpanel"

http://robslink.com/SAS/democd52/gas_class_2012.htm

http://robslink.com/SAS/democd52/gas_class_2012_info.htm

data_null__
Jade | Level 19

Thanks Robert I knew the option I wanted was in the AXIS statement but I was hopeing to stay with GTL.  I was NOT aware of HTML panel.  Is there RTFPANEL?

GraphGuy
Meteorite | Level 14

I'm not 100% sure, but I've never heard of "rtfpanel", so I think this is an html-only thing.

I guess if you had to have rtf output, you could use Gplot & set the length on the axis statement, and then greplay the plots into a greplay template with 3 columns (but this would require a lot more manual work, than the automatic layout you would get with 'ods htmlpanel').

I guess it all depends on what is the desired end-result, and what of that is hard & fast "requirements" versus what is "preferences"?

DanH_sas
SAS Super FREQ

The GSCALE function cannot be used in the axisopts directly; however, you could stick the result of the function in macro variables that you can use in the template. Also, it may be possible that GSCALE returns nice start and end points that are beyond the end of the data. Therefore, I would also set the start and end macro variables on the VIEWMIN and VIEWMAX options to make sure the axis expands to accomodate your tick range.

Hope this helps,

Dan

data_null__
Jade | Level 19

DanH@sas wrote:

The GSCALE function cannot be used in the axisopts directly; however, you could stick the result of the function in macro variables that you can use in the template. Also, it may be possible that GSCALE returns nice start and end points that are beyond the end of the data. Therefore, I would also set the start and end macro variables on the VIEWMIN and VIEWMAX options to make sure the axis expands to accomodate your tick range.

Hope this helps,

Dan


Thanks Dan, I understand that GSCALE cannot be called within GTL.  I have all that working. 

I don't understand your next comment.  It appears to me that GSCALE will always returns a tick range that includes all data.  I don't know if that is documented but it appears be working that way.

GTL on the other hand when scaling the tick range appears to produce tick values that may not include the min and/max data points but the min and max are still plotted.  This produces a nicer looking plot.

For example given a data range of -199.680 to 167.340 GSCALE(NINCR= -4) gives START=-200 END=200 INCREMENT=100, while GTL using default threshold and view parameters gives -200 to 100 by 100 with the max at 167.34 still displayed on the graph.

Ideally I would like to call the GTL scale routine directly and have it give me START END and INC like GSCALE does using the apparently more sophisticated algorithm.  Got any ideas about that?

DanH_sas
SAS Super FREQ

My concern was that GSCALE might return starting and ending tick marks beyond the range of the data, and that those tick marks would sometimes not appear unless the axis range was extended accordingly with VIEWMIN/VIEWMAX. If those tick marks fall within the tick value THRESHOLDMIN/MAX (see doc under LINEAROPTS), then they are drawn even if they go beyond the data range. Your "200" was outside the threshold, so it was dropped. However, if you add the START and END values to the VIEWMIN/MAX options and use TICKVALUESEQUENCE to specify the start, end, and increment, you should get what GSCALE recommended (unless there is a tick value collision, which will cause thinning). Does this answer your question?

Thanks!
Dan

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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