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.
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:
(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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.