I have been working with this annoying box plot for couple of DAYS! This is SAS University edition. Hope you could help me out unify same values in x axis.
proc import datafile="/folders/myfolders/sasuser.v94/chap1_3_97.xls"
out=work.q01_01
dbms=xls
replace;
run;
libname mylib '/folders/myfolders/sasuser.v94/mylib';
data mylib.q01_01;
set q01_01;
run;
proc print data = mylib.q01_01;
run;
/* print box plot */
proc boxplot data=mylib.q01_01;
plot smoking_rate * town_type ;
run;
I expect only two values in x axis: city and country. However, the actual output is loops of city and country.
Apparently the BOXPLOT procedure wants the input data ordered by the grouping variable. Try this example using a dataset that every SAS installation should have.
proc sort data=sashelp.class out=class;
by sex;
run;
proc boxplot data=class;
plot height * sex ;
run;
Or for your dataset:
proc sort data = mylib.q01_01 out=q01_01;
by town_type;
run;
proc boxplot data=q01_01;
plot smoking_rate * town_type ;
run;