BookmarkSubscribeRSS Feed
cgsmaok56
Calcite | Level 5

Hi, I opened a ticket with SAS Tech Support one week ago and they have not been able to help me.  I am trying to use an AXIS statement with PROC BOXPLOT and what I am specifying in the AXIS statement does not appear in the resulting output (in either the .lst file or the .rtf file).  Here is the code that I am using.

 

symbol color = blue h = .8;
goptions ftext=swiss cback=white;
axis1 minor=none color=black label=(angle=90 rotate=0);
axis2 label=none /*order=(1 to 2 by 1)*/ major=(h=.8) value=(t=1 h=3 j=c "(N=&phase1)" t=2 h=3 j=c "(N=&phase2)");

 

title 'Box Plot for Infusion Duration by Phase';
proc boxplot data=phase;
plot INF_DURN * PHASE_ENRL/ cframe = vligb
cboxes = dagr
cboxfill = ywh
vaxis = axis1
haxis = axis2;
run;

 

The axis1 statement (for the vaxis) works just fine.  However, the axis2 statement (for the haxis) has absolutely no effect.  What I am trying to do is show the number of subjects in the two groups on the horizontal axis.  I create macro variables for &phase1 and &phase2.  When I run the program using the SYMBOLGEN option it shows that these two marcro variables do resolve.  So that is not the problem.

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @cgsmaok56 and welcome to the SAS Support Communities!

 

With this AXIS statement

axis2 label=(h=2 "Group") order=(1 to 2)
      major=(h=.8) value=(t=1 h=2 "1" j=c h=2 "(N=&phase1)"
                          t=2 h=2 "2" j=c h=2 "(N=&phase2)");

and values of 123 and 456 for the two macro variables I obtain this x-axis:

x_axis.png

(using Windows SAS 9.4M5 and a sample dataset PHASE containing values 1 and 2 for variable PHASE_ENRL and random INF_DURN values).

 

Alternatively, you could keep your label=none and use, e.g., "group 1" and "group 2" (rather than "1" and "2") as tick mark labels.

cgsmaok56
Calcite | Level 5
Thank you. The solution worked.

Carey

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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