BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Chaupak
Obsidian | Level 7

Hi, I am trying to add an xaxistable under the x axis in proc sgplot. It worked well at first:

 

sasforum3.png

 

Then I wanted to move the ticks on the x axis to the left to make point 0 at the left bottom corner (the origin) using the 'offsetmin = 0' option in xaxis statement. After doing this, the value (4179) for x=0 was truncated to 79:

 

sasforum1.png

The value remained truncated even after I removed the label of the table:

 

sasforum2.png

Is there any way to let the value for 0 display normally when I use offsetmin = 0 for x axis? Doesn't have to use xaxistable statement.

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

The area to the left of the Y axis is protected to prevent possible collisions. That's why you got the clipping when you overrode the OFFESETMIN. This behavior can happen with plot primitives as well (e.g. bar, markers, etc.). The only workaround to get exactly what you want is to turn off the axis table and use annotations, which are not impacted by protected regions.

 

See page 4 and page 6 my annotation paper (https://support.sas.com/resources/papers/proceedings11/277-2011.pdf) to see the details of the steps I list below:

 

Steps:

1) Create an annotation data set as described in the paper. Page 6 is probably the best example for you (as you will probably have input data), but you will flip the "space" specifications, since you are creating a table along the bottom. The example on page 4 might make the space specifications for bottom tables clearer.

2) Remove your axis table(s)

3) On the SGPLOT statement, set PAD=(BOTTOM=<some amount>) to create the needed space along the bottom of the graph

4) Specify your annotation data set on the SGPLOT statement using the SGANNO option.

 

Hope this helps!

Dan

View solution in original post

4 REPLIES 4
DanH_sas
SAS Super FREQ

The area to the left of the Y axis is protected to prevent possible collisions. That's why you got the clipping when you overrode the OFFESETMIN. This behavior can happen with plot primitives as well (e.g. bar, markers, etc.). The only workaround to get exactly what you want is to turn off the axis table and use annotations, which are not impacted by protected regions.

 

See page 4 and page 6 my annotation paper (https://support.sas.com/resources/papers/proceedings11/277-2011.pdf) to see the details of the steps I list below:

 

Steps:

1) Create an annotation data set as described in the paper. Page 6 is probably the best example for you (as you will probably have input data), but you will flip the "space" specifications, since you are creating a table along the bottom. The example on page 4 might make the space specifications for bottom tables clearer.

2) Remove your axis table(s)

3) On the SGPLOT statement, set PAD=(BOTTOM=<some amount>) to create the needed space along the bottom of the graph

4) Specify your annotation data set on the SGPLOT statement using the SGANNO option.

 

Hope this helps!

Dan

Chaupak
Obsidian | Level 7

Thanks so much Dan, that's a very detail answer! I fixed this problem using the annotation now.   

Jay54
Meteorite | Level 14

Dan has already provided a good solution.  The following is just an FYI...

The underlying AXISTABLE statement in GTL provides an option to justify the values in the table.  See:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/p0v5nj3waz75w4n1s2y70echq6im.htm

 

You could use the SGPLOT TMPLOUT option to get the generated GTL code, and then make the above change to the AXISTABLE statement.

 

Note: This may allow you to draw the values justified left.  However, this could have other side effects on the other side of the axis.

Chaupak
Obsidian | Level 7
Thanks!

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
  • 1576 views
  • 2 likes
  • 3 in conversation