my SAS 9.4
I need to do proc boxplot CHARTS, but i need key legend appears in key simple like this picture any one help me for code statement
OR WHATS FIXED PROBLEM
THANK YOU IN ADVANCE...
my SAS 9.4
I need to do proc boxplot CHARTS, but i need key legend appears in key simple like this picture any one help me for code statement
OR WHATS FIXED PROBLEM
THANK YOU IN ADVANCE...
YES HER
data Biofilm_DivalentCation;
input DivalentCation$ C5C6C7C8C10;
input DivalentCation $ @;
do i=1 to 5;
input OD595nm_Biofilm @;
output;
end;
drop i;
datalines;
AB 0.089999997 0.075300001 1.191499971 0.068400004 1.32260003
AB 0.081 0.093600005 0.914500028 0.259900004 0.691099972
AB 0.077999994 0.101899981 0.681099981 0.076799989 0.842699975
Ca 1.395499945 0.815599978 1.254999995 1.157600045 1.062000036
Ca 0.919200003 1.249100029 1.456199944 1.537399948 1.042699993
Ca 1.147799999 1.076700002 1.446700007 1.399500042 0.887599975
Mg 1.254799977 1.345600024 1.626799956 1.794299975 1.777199998
Mg 1.544299953 1.192399971 1.796699993 1.881999962 1.576500051
Mg 1.244000018 1.113900006 1.786600053 1.780900061 1.393999994
Mg 1.642700009 1.39570003 2.536299996 2.711999945 1.393099956
;
PROC GLM data= Biofilm_DivalentCation;
class DivalentCation;
model C5C6C7C8C10=DivalentCation;
means DivalentCation/duncan;
run;
symbol color= salmonh = .8;
goptions ftext=swiss;
axis1 minor=none color=black label=(angle=90 rotate=0);
title’boxplot for Biofilm_DivalentCation’;
proc boxplot data=Biofilm_DivalentCation;
plot OD595nm_Biofilm*DivalentCation / vaxis = axis1
haxis = axis2
cboxes = BL ;
insetgroup mean (6.1) Min Max Q1 Q3 / header = 'OD595nm_Biofilm'
pos = top
cfill = pink;
run;
Here is a roundabout way to do it:
data Biofilm_DivalentCation;
input DivalentCation$ C5C6C7C8C10;
input DivalentCation $ @;
do i=1 to 5;
input OD595nm_Biofilm @;
output;
end;
drop i;
datalines;
AB 0.089999997 0.075300001 1.191499971 0.068400004 1.32260003
AB 0.081 0.093600005 0.914500028 0.259900004 0.691099972
AB 0.077999994 0.101899981 0.681099981 0.076799989 0.842699975
Ca 1.395499945 0.815599978 1.254999995 1.157600045 1.062000036
Ca 0.919200003 1.249100029 1.456199944 1.537399948 1.042699993
Ca 1.147799999 1.076700002 1.446700007 1.399500042 0.887599975
Mg 1.254799977 1.345600024 1.626799956 1.794299975 1.777199998
Mg 1.544299953 1.192399971 1.796699993 1.881999962 1.576500051
Mg 1.244000018 1.113900006 1.786600053 1.780900061 1.393999994
Mg 1.642700009 1.39570003 2.536299996 2.711999945 1.393099956
;
PROC GLM data= Biofilm_DivalentCation;
class DivalentCation;
model C5C6C7C8C10=DivalentCation;
means DivalentCation/duncan;
run;
quit;
ods output sgplot=boxdata;
proc sgplot data=Biofilm_DivalentCation;
vbox OD595nm_Biofilm / category=DivalentCation;
run;
data newBoxData;
set boxdata;
rename BOX_OD595NM_BIOFILM_X_DIVALE___X = DivalentCation;
rename BOX_OD595NM_BIOFILM_X_DIVALE___Y = OD595nm_Biofilm;
length stat $ 6;
stat=" ";
if (BOX_OD595NM_BIOFILM_X_DIVALE__ST eq "Q1") then stat="Q1";
if (BOX_OD595NM_BIOFILM_X_DIVALE__ST eq "Q3") then stat="Q3";
if (BOX_OD595NM_BIOFILM_X_DIVALE__ST eq "MEDIAN") then stat="Median";
if (BOX_OD595NM_BIOFILM_X_DIVALE__ST eq "DATAMIN") then stat="Min";
if (BOX_OD595NM_BIOFILM_X_DIVALE__ST eq "DATAMAX") then stat="Max";
run;
data attrmap;
retain id "statmap" markercolor "black";
length value $ 7 markersymbol $ 14;
input value $ markersymbol $;
cards;
Q1 squarefilled
Q3 trianglefilled
Median X
Min circlefilled
Max diamondfilled
;
run;
title "boxplot for Biofilm_DivalentCation";
proc sgplot data=newBoxData dattrmap=attrmap;
where stat ne " ";
scatter x=DivalentCation y=OD595nm_Biofilm / group=stat attrid=statmap;
run;
still, key legend doesn't appear
That's not a standard boxplot by any means. Can you post what you have so far, in a post. I'm not comfortable dowloading external files.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.