/* Lesson 8-1 */ /* File Name = les0801.sas 06/22/00 */ data gakusei; infile 'all00.prn'; input seibetsu $ height weight chest jitaku $ kodukai; proc print data=gakusei(obs=10); run; : proc means data=gakusei; : 平均、標準偏差、最大最小値の算出 var kodukai; : 小遣いについて run; : proc sort data=gakusei; : 並べ替え(ソート) by jitaku; : 自宅生/下宿生別に run; : proc means data=gakusei; : 平均、標準偏差、最大最小値の算出 var kodukai; : 小遣いについて by jitaku; : 自宅生/下宿生別に run; : : proc chart data=gakusei; : 図示 hbar kodukai; : 水平棒グラフで run; : proc chart data=gakusei; : 図示 hbar kodukai; : 水平棒グラフで by jitaku; : 自宅生/下宿生別に run; : proc chart data=gakusei; : 図示 hbar kodukai/group=jitaku; : 水平棒グラフで、グループ別に(並列) run; :
SAS システム 1 00:22 Thursday, June 22, 2000 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI 1 F 145.0 38 . J 10000 2 F 148.0 42 . J 50000 3 F 148.9 . . J 60000 4 F 154.0 46 . . 5 F 155.0 . . J 20000 6 F 156.0 49 85 J 25000 7 M 156.0 61 90 J 0 8 F 156.0 . . J 30000 9 F 156.0 . . J 50000 10 F 156.0 . . G . SAS システム 2 00:22 Thursday, June 22, 2000 Analysis Variable : KODUKAI N Mean Std Dev Minimum Maximum ----------------------------------------------------------- 147 52642.86 52967.33 0 300000.00 ----------------------------------------------------------- SAS システム 3 00:22 Thursday, June 22, 2000 Analysis Variable : KODUKAI ------------------------------- JITAKU=' ' ----------------------------- N Mean Std Dev Minimum Maximum ----------------------------------------------------------- 3 26666.67 25166.11 0 50000.00 ----------------------------------------------------------- SAS システム 4 00:22 Thursday, June 22, 2000 Analysis Variable : KODUKAI -------------------------------- JITAKU=G ------------------------------ N Mean Std Dev Minimum Maximum ----------------------------------------------------------- 50 107260.00 54292.03 0 300000.00 ----------------------------------------------------------- SAS システム 5 00:22 Thursday, June 22, 2000 Analysis Variable : KODUKAI -------------------------------- JITAKU=J ------------------------------ N Mean Std Dev Minimum Maximum ----------------------------------------------------------- 94 24420.21 20176.55 0 100000.00 ----------------------------------------------------------- SAS システム 6 00:22 Thursday, June 22, 2000 KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 20000 |***************** 83 83 56.46 56.46 60000 |***** 25 108 17.01 73.47 100000 |*** 17 125 11.56 85.03 140000 |*** 15 140 10.20 95.24 180000 |* 5 145 3.40 98.64 220000 | 1 146 0.68 99.32 260000 | 0 146 0.00 99.32 300000 | 1 147 0.68 100.00 | ----+---+---+---+- 20 40 60 80 Frequency SAS システム 7 00:22 Thursday, June 22, 2000 ------------------------------ JITAKU=' ' ------------------------------ KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 0 |******************** 1 1 33.33 33.33 | 25000 |******************** 1 2 33.33 66.67 | 50000 |******************** 1 3 33.33 100.00 | --------------------+ 1 Frequency SAS システム 8 00:22 Thursday, June 22, 2000 ------------------------------- JITAKU=G ------------------------------- KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 0 |**** 4 4 8.00 8.00 60000 |************** 14 18 28.00 36.00 120000 |***************** 17 35 34.00 70.00 180000 |************** 14 49 28.00 98.00 240000 | 0 49 0.00 98.00 300000 |* 1 50 2.00 100.00 | -----+----+----+-- 5 10 15 Frequency SAS システム 9 00:22 Thursday, June 22, 2000 ------------------------------- JITAKU=J ------------------------------- KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 7500 |**************************** 28 28 29.79 29.79 22500 |*********************** 23 51 24.47 54.26 37500 |**************************** 28 79 29.79 84.04 52500 |******** 8 87 8.51 92.55 67500 |***** 5 92 5.32 97.87 82500 |* 1 93 1.06 98.94 97500 |* 1 94 1.06 100.00 | -----+----+----+----+----+--- 5 10 15 20 25 Frequency SAS システム 10 00:22 Thursday, June 22, 2000 JITAKU KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 20000 | 2 2 1.36 1.36 60000 | 1 3 0.68 2.04 100000 | 0 3 0.00 2.04 140000 | 0 3 0.00 2.04 180000 | 0 3 0.00 2.04 220000 | 0 3 0.00 2.04 260000 | 0 3 0.00 2.04 300000 | 0 3 0.00 2.04 | G 20000 |* 4 7 2.72 4.76 60000 |** 9 16 6.12 10.88 100000 |*** 15 31 10.20 21.09 140000 |*** 15 46 10.20 31.29 180000 |* 5 51 3.40 34.69 220000 | 1 52 0.68 35.37 260000 | 0 52 0.00 35.37 300000 | 1 53 0.68 36.05 | J 20000 |*************** 77 130 52.38 88.44 60000 |*** 15 145 10.20 98.64 100000 | 2 147 1.36 100.00 140000 | 0 147 0.00 100.00 180000 | 0 147 0.00 100.00 220000 | 0 147 0.00 100.00 260000 | 0 147 0.00 100.00 300000 | 0 147 0.00 100.00 | ----+---+---+--- 20 40 60 Frequency
/* Lesson 8-2 */ /* File Name = les0802.sas 06/22/00 */ data gakusei; infile 'all00.prn'; input seibetsu $ height weight chest jitaku $ kodukai; proc print data=gakusei(obs=10); run; : proc freq data=gakusei; : 頻度を算出 tables seibetsu jitaku; : 一変量ごとで run; : proc freq data=gakusei; : 頻度を算出 tables seibetsu*jitaku; : 二変量の組み合わせで run; :
SAS システム 2 00:22 Thursday, June 22, 2000 Cumulative Cumulative SEIBETSU Frequency Percent Frequency Percent ------------------------------------------------------ F 43 26.2 43 26.2 M 121 73.8 164 100.0 Frequency Missing = 2 Cumulative Cumulative JITAKU Frequency Percent Frequency Percent ---------------------------------------------------- G 53 35.3 53 35.3 J 97 64.7 150 100.0 Frequency Missing = 16 SAS システム 4 00:22 Thursday, June 22, 2000 TABLE OF SEIBETSU BY JITAKU SEIBETSU JITAKU Frequency| Percent | Row Pct | Col Pct |G |J | Total ---------+--------+--------+ F | 10 | 27 | 37 | 6.71 | 18.12 | 24.83 | 27.03 | 72.97 | | 19.23 | 27.84 | ---------+--------+--------+ M | 42 | 70 | 112 | 28.19 | 46.98 | 75.17 | 37.50 | 62.50 | | 80.77 | 72.16 | ---------+--------+--------+ Total 52 97 149 34.90 65.10 100.00 Frequency Missing = 17
/* Lesson 8-3 */ /* File Name = les0803.sas 06/22/00 */ data gakusei; infile 'all00.prn'; input seibetsu $ height weight chest jitaku $ kodukai; proc format; : 新しい階級(clheight)を作る value clheight low-<150=' -149' : 階級の定義 1 150-<160='150-159' : 2 160-<170='160-169' : 3 170-<180='170-179' : 4 180-high='180- ' : 5 other ='missing'; : 6 run; : : proc print data=gakusei(obs=10); : run; : : proc freq data=gakusei; : 頻度を算出 tables height; : 一変量ごとで format height clheight.; : 連続量をグループ化 run; : proc sort data=gakusei; : 並べ替え by seibetsu; : 性別で run; : proc freq data=gakusei; : 頻度を算出 tables height; : 一変量ごとで format height clheight.; : 連続量をグループ化 by seibetsu; : 性別で run; : : proc freq data=gakusei; : 頻度を算出 : 上記と同じ結果になる tables height*seibetsu; : 二変量の組合わせで format height clheight.; : 連続量をグループ化 run; :
SAS システム 2 10:05 Thursday, June 22, 2000 Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- -149 3 1.9 3 1.9 150-159 14 8.9 17 10.8 160-169 53 33.8 70 44.6 170-179 75 47.8 145 92.4 180- 12 7.6 157 100.0 Frequency Missing = 9 SAS システム 3 10:05 Thursday, June 22, 2000 ----------------------------- SEIBETSU=' ' ----------------------------- Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- Frequency Missing = 2 SAS システム 4 10:05 Thursday, June 22, 2000 ------------------------------ SEIBETSU=F ------------------------------ Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- -149 3 7.7 3 7.7 150-159 13 33.3 16 41.0 160-169 22 56.4 38 97.4 170-179 1 2.6 39 100.0 Frequency Missing = 4 SAS システム 5 10:05 Thursday, June 22, 2000 ------------------------------ SEIBETSU=M ------------------------------ Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- 150-159 1 0.8 1 0.8 160-169 31 26.3 32 27.1 170-179 74 62.7 106 89.8 180- 12 10.2 118 100.0 Frequency Missing = 3 SAS システム 6 10:05 Thursday, June 22, 2000 TABLE OF HEIGHT BY SEIBETSU HEIGHT SEIBETSU Frequency| Percent | Row Pct | Col Pct |F |M | Total ---------+--------+--------+ -149 | 3 | 0 | 3 | 1.91 | 0.00 | 1.91 | 100.00 | 0.00 | | 7.69 | 0.00 | ---------+--------+--------+ 150-159 | 13 | 1 | 14 | 8.28 | 0.64 | 8.92 | 92.86 | 7.14 | | 33.33 | 0.85 | ---------+--------+--------+ 160-169 | 22 | 31 | 53 | 14.01 | 19.75 | 33.76 | 41.51 | 58.49 | | 56.41 | 26.27 | ---------+--------+--------+ 170-179 | 1 | 74 | 75 | 0.64 | 47.13 | 47.77 | 1.33 | 98.67 | | 2.56 | 62.71 | ---------+--------+--------+ 180- | 0 | 12 | 12 | 0.00 | 7.64 | 7.64 | 0.00 | 100.00 | | 0.00 | 10.17 | ---------+--------+--------+ Total 39 118 157 24.84 75.16 100.00 Frequency Missing = 9
/* Lesson 8-4 */ /* File Name = les0804.sas 06/22/00 */ data gakusei; infile 'all00.prn'; input seibetsu $ height weight chest jitaku $ kodukai; proc format; value clheight low-<150=' -149' 150-<160='150-159' 160-<170='160-169' 170-<180='170-179' 180-high='180- ' other ='missing'; run; proc print data=gakusei(obs=10); run; : proc tabulate data=gakusei; : 帳票の作成 class height seibetsu; : 特性変数であることの宣言 var weight; : 集計する変量名 tables weight*(n mean std),height*seibetsu; : 表示内容、分類変量名 format height clheight.; : 身長のクラス分けの定義 run; :
SAS システム 2 10:49 Thursday, June 22, 2000 ---------------------------------------------------------------------- | | HEIGHT | | |---------------------------------------------------| | | -149 | 150-159 | 160-169 | | |------------+-------------------------+------------| | | SEIBETSU | SEIBETSU | SEIBETSU | | |------------+-------------------------+------------| | | F | F | M | F | |----------------+------------+------------+------------+------------| |WEIGHT |N | 2.00| 6.00| 1.00| 11.00| | |--------+------------+------------+------------+------------| | |MEAN | 40.00| 48.00| 61.00| 51.18| | |--------+------------+------------+------------+------------| | |STD | 2.83| 3.10| .| 2.36| ---------------------------------------------------------------------- (CONTINUED) SAS システム 3 10:49 Thursday, June 22, 2000 ---------------------------------------------------------------------- | | HEIGHT | | |---------------------------------------------------| | | 160-169 | 170-179 | 180- | | |------------+-------------------------+------------| | | SEIBETSU | SEIBETSU | SEIBETSU | | |------------+-------------------------+------------| | | M | F | M | M | |----------------+------------+------------+------------+------------| |WEIGHT |N | 31.00| 0.00| 74.00| 12.00| | |--------+------------+------------+------------+------------| | |MEAN | 59.31| .| 62.95| 65.33| | |--------+------------+------------+------------+------------| | |STD | 7.23| .| 5.92| 6.84| ----------------------------------------------------------------------