BookmarkSubscribeRSS Feed
rang999
Calcite | Level 5

HI,

Using proc boxlplot i want to have different colors for different treatment groups for the horizontal lines.

below is the code i am using.

/* i am using summary stats as input from the proc means */

proc boxplot history = datxxx;

     plot rsl1n*nvisit=ntrt / boxconnet=mean cconnect=green cboxes=(ncolor) haxis=(0,1,2,3,4,5,6,7,8,9,10)

                                     vref= 8 6 4 2 cvref=blue;

     format nvisit visnum_.;

run;

in the above code for example for vref=8 6 4 2 --- for 8 i want green color and for 6 blue and so on.

Thanks.

Rang


code.PNGgraph.PNGdata sample.PNG
4 REPLIES 4
ballardw
Super User

The cvref option will take a color list. Match the color IN ORDER with teh VREF option

cvref = (green blue colorfor4 colorfor2)

rang999
Calcite | Level 5

Hi,

if i use cvref = (green blue ....) i get an syntax error for parenthesis.

i am using SAS 9.1.3.


one more question. how do i center align the vertical axis label. i am using defining axis and using it in proc boxplot as vaxis=axis2.

vertical axis label is not center aligned even when i mention j=c in the axis statement.

appreciate your help.

ballardw
Super User

The CVREF accepting a list may have been a change in 9.2.

Text options such as justification in AXIS labels need to come before the text affected. This one of the common syntax misunderstanding with several of the SAS Graph statements. It is actually a feature as the label can be split into parts with font color, size, and weight changing for different pieces.

Post the offending code when possible to help diagnosis such things as there could be other issues.

dodors57
Calcite | Level 5

Hi !

I use SAS 9.4.

 

ods graphics off;
axis1 label = (height = 1 'xxx') ; axis2 order = (0 to 5 by 1) label = (height = 1 'yyy') ; symbol value = dot cv=blue height = 1 ; proc boxplot data=table; plot var1*var2 / vref=3 20 cvref=(green red) haxis=axis1 vaxis=axis2; insetgroup N="N" min="Mini" (5.1) MEAN="Moyenne" (5.1) std="E.T." (5.1) Q2="Médiane" (5.1) max="Maxi" (5.1) / header = 'Statistiques descriptives' position=topoff; run;

I get a syntax error for parenthesis too.

Help me please. Thanks.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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