Help using Base SAS procedures

proc boxplot - how to assign different colors for VREF values based on the treatment group

Reply
New Contributor
Posts: 4

proc boxplot - how to assign different colors for VREF values based on the treatment group

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
Super User
Posts: 11,343

Re: proc boxplot - how to assign different colors for VREF values based on the treatment group

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

cvref = (green blue colorfor4 colorfor2)

New Contributor
Posts: 4

Re: proc boxplot - how to assign different colors for VREF values based on the treatment group

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.

Super User
Posts: 11,343

Re: proc boxplot - how to assign different colors for VREF values based on the treatment group

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.

Ask a Question
Discussion stats
  • 3 replies
  • 555 views
  • 0 likes
  • 2 in conversation