盒形图又称箱线图(box plot),由一组数据的最大值最小值中位数和两个四分位数5个特征值绘制而成,反映原始数据分布的图形.
例如
data wh100;
input h w @@;
if w<=50.3 then wc= ' <=50.3';
else if w>50.3 and w<=54.1 then wc= '50.4-54.1';
else if w>54.1 and w<=57.9 then wc= '54.2-57.9';
else if w>57.9 and w<=61.7 then wc= '58.0-61.7';
else if w>61.7 and w<=65.5 then wc= '61.8-65.5';
else if w>65.5 and w<=69.3 then wc= '65.6-69.3';
else if w>69.3 and w<=73.1 then wc= '69.4-73.1';
else wc= '>=73.2';
wgroup=int((w-46.5)*8/(77-46.5)-0.001)+1;
cards;
172.4 75.0 169.3 54.8 169.3 64.0 171.4 64.8 166.5 47.4 171.4 62.2
168.2 66.9 165.1 52.0 168.8 62.2 167.8 65.0 165.8 62.2 167.8 65.0
164.4 58.7 169.9 57.5 164.9 63.5 160.3 55.2 175.0 66.6 172.5 73.5
172.0 64.0 168.4 57.0 155.0 57.0 175.5 63.9 172.3 69.0 168.6 58.0
176.4 56.9 173.2 57.5 167.5 50.0 169.4 52.2 166.7 72.0 169.5 57.0
165.7 55.4 161.2 48.5 172.8 57.0 175.1 75.5 157.5 50.5 169.8 62.9
168.6 63.4 172.6 61.0 163.8 58.5 165.1 61.5 166.7 52.5 170.9 61.0
166.1 69.5 166.2 62.5 172.4 52.6 172.8 60.0 177.8 63.9 162.7 56.8
168.8 54.0 169.1 66.2 177.5 60.0 177.0 66.2 169.9 55.9 167.4 54.4
169.3 58.4 172.8 72.8 169.8 58.0 160.0 65.3 179.1 62.2 172.3 49.8
163.3 46.5 172.9 66.7 165.4 58.0 175.8 63.2 162.3 52.2 165.4 65.7
171.5 59.3 176.6 66.3 181.7 68.6 175.2 74.9 169.5 59.5 169.6 61.5
169.1 63.1 185.5 77.0 173.9 65.5 162.5 50.0 171.5 58.5 175.6 59.8
166.0 75.5 167.2 63.3 171.9 57.0 176.6 58.4 177.3 67.0 169.2 71.8
166.2 49.8 181.7 63.0 175.8 68.3 172.3 55.5 172.7 58.5 174.3 64.0
171.2 59.0 174.8 68.0 165.4 55.5 169.1 64.8 167.9 62.0 176.8 64.0
183.5 69.9 165.5 48.6 171.0 70.5 170.3 58.5
;
proc print data=wh100;
run;
proc freq data=wh100;
tables wc ; /* tables wgroup; */
title '100名学生的体重分为8个组的频数表';
run;
proc chart data=wh100;
vbar w / midpoints=48 to 76 by 4;
title '对学生体重数据使用选项MIDPOINT=产生的条形图';
run;
proc chart data=wh100;
vbar wgroup / discrete; /* vbar wc / discrete; */
title '把输出1.2.1的频数表用条形图表示';
run;
proc univariate data=wh100 plot;
var w;
run;
图中最右侧即为利用sas所作的盒形图,意为这一组数据最大值为76,最小值为46,中位数为60,两个四分位数分别为64和56……
hfvurnn154 2014-10-21