BookmarkSubscribeRSS Feed
Jagadishkatam
Amethyst | Level 16

Hi Experts,

I am trying to generate the bar chart by using the below code in sas 9.2 version.

data have;

  input disease$ days treat grade;

cards;

fever 4 2 2

fever 1 2 1

;

   

legend1 across=1 mode=protect position=(TOP RIGHT OUTSIDE) ;

axis1 label=("Count" ) order=(0 to 4 by 1) minor=none;

axis2 label=("Treatment") order=(1,2) minor=none ;

axis3 label=( "Days") order=(1 to 7 by 1) minor=none ;

proc gchart data=have;

by disease;

   vbar treat / group=days  subgroup=grade midpoints=(1 2 )  raxis=axis1

maxis=axis2

gaxis=axis3 discrete  space=0.5 noframe legend=legend1 width=2.5;

run;

quit;

The problem here is i am getting a

WARNING: Order value specified in the AXIS statement does not match a midpoint value.

This is related to the gaxis=axis3, as i want to display the dummy days as well. so could you  please suggest required changes to the code and avoid the warning.

Thanks,

Jag

Thanks,
Jag
3 REPLIES 3
DanH_sas
SAS Super FREQ

I believe the warning is not coming from the ORDER on the axis3 statement (the group axis), but from the ORDER on the axis2 statement (midpoint axis). I think if you just remove the ORDER from that statement, the MIDPOINT option on the VBAR statement will give you what you want. Let me know if that does not work for you. Thanks!

Jagadishkatam
Amethyst | Level 16

Per your suggestion i tried the following but still the warning is coming

legend1 across=1 mode=protect position=(TOP RIGHT OUTSIDE) ;

axis1 label=("Count" ) order=(0 to 4 by 1) minor=none;

axis2 label=("Treatment") minor=none ;

axis3 label=( "Days") order=(1 to 7 by 1) minor=none ; 

proc gchart data=have;

by disease;

   vbar treat / group=days  subgroup=grade midpoints=(1 2 )  raxis=axis1

maxis=axis2

gaxis=axis3 lref=0 cref=cyan wref=5 discrete  space=0.5 noframe legend=legend1 width=2.5;

run;

quit;

Thanks,
Jag
Jagadishkatam
Amethyst | Level 16

Hi Dan,

Could you please let me know if there is any alternative approach.

Thanks,

Jag

Thanks,
Jag

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1799 views
  • 0 likes
  • 2 in conversation