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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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