BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
I am using PROC GCHART to create a vertical bar chart.
The problem is that the major ticks marks appear in the vertical axis but not in the horizontal axis.
I have tried to put in the axis definition the option major=(number=5), but the major ticks don't appear and in the log there is this message:

WARNING: The MAJOR= option on AXIS statement 22 was ignored because the Month axis does not support MAJOR=.

I'd like to know if it's possible to show the major ticks marks in a PROC GCHART (when i use the same axis define in a PROC GPLOT there's not problem), and if it's possible, how can i do it.

Thanks in advance,
Elena


Axis1 /*** vertical axis ***/
STYLE=1
WIDTH=1
MINOR=NONE
LABEL=( HEIGHT=9pt "" )
VALUE=(HEIGHT=9pt);

Axis2 /* horizontal */
STYLE=1
WIDTH=1
MINOR=NONE
major=(number=5)
LABEL=( HEIGHT=9pt "" )
VALUE=(HEIGHT=9pt);


PROC GCHART DATA=A;
VBAR MONTH /
DISCRETE
SUMVAR=Request
SUBGROUP=PRIORITY
SPACE=1
html=link
MISSING
FRAME TYPE=SUM
LEGEND=LEGEND1
COUTLINE=SAME
RAXIS=AXIS1
MAXIS=AXIS2;
RUN;
2 REPLIES 2
GraphGuy
Meteorite | Level 14
Traditional sas/graph gcharts allow tickmarks on the response (height) axis, but not on the midpoint (bar) axis.

I guess the reasoning is something like ... if you have a bar & a bar value/label at every data point, why the need for tickmarks? Also, since the bars are at discrete/categorical values it wouldn't really make sense to have tickmarks (tickmarks are for proportionally-spaced numeric ranges).

If you *really* need tickmarks on the bar axis, you could annotate them (but that's a lot of work, and I'm not sure it really gains you anything).

---

Ok, so much for my soapbox! 🙂

Here's the code to annotate tickmarks at each bar:

[pre]
data tick_anno; set sashelp.class;
xsys='2'; ysys='1';
function='move'; midpoint=name; y=0; output;
function='draw'; y=-.7; output;
run;

axis1 value=(angle=90);
proc gchart data=sashelp.class anno=tick_anno;
vbar name / type=sum sumvar=height descending maxis=axis1;
run;
[/pre]
deleted_user
Not applicable
Thank you so much!!!

I don't really need tickbars... but a client has asked me if it was possible to see the graphs with tickmarks, so i'm going to try annotating them.

Thanks and regards!
Elena

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
  • 2 replies
  • 1083 views
  • 0 likes
  • 2 in conversation