/* Lesson 10-1 */ /* File Name = les1001.sas 06/21/01 */ data gakusei; infile 'all01.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 システム 1 10:08 Wednesday, June 20, 2001 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI 1 F 145.0 38.0 . J 10000 2 F 148.0 42.0 . J 50000 3 F 148.9 . . J 60000 4 F 149.0 45.0 . G 60000 5 F 150.0 46.0 86 40000 6 F 151.7 41.5 80 J 35000 7 F 153.0 46.5 87 G 10000 8 F 153.0 55.0 78 J 30000 9 F 154.0 46.0 . . 10 F 155.0 48.0 83 G 180000 SAS システム 2 10:08 Wednesday, June 20, 2001 Cumulative Cumulative SEIBETSU Frequency Percent Frequency Percent ------------------------------------------------------ F 59 29.1 59 29.1 M 144 70.9 203 100.0 Frequency Missing = 2 Cumulative Cumulative JITAKU Frequency Percent Frequency Percent ---------------------------------------------------- G 63 35.2 63 35.2 J 116 64.8 179 100.0 Frequency Missing = 26 SAS システム 4 10:08 Wednesday, June 20, 2001 TABLE OF SEIBETSU BY JITAKU SEIBETSU JITAKU Frequency| Percent | Row Pct | Col Pct |G |J | Total ---------+--------+--------+ F | 15 | 36 | 51 | 8.43 | 20.22 | 28.65 | 29.41 | 70.59 | | 24.19 | 31.03 | ---------+--------+--------+ M | 47 | 80 | 127 | 26.40 | 44.94 | 71.35 | 37.01 | 62.99 | | 75.81 | 68.97 | ---------+--------+--------+ Total 62 116 178 34.83 65.17 100.00 Frequency Missing = 27
/* Lesson 10-2 */ /* File Name = les1002.sas 06/21/01 */ data gakusei; infile 'all01.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 freq data=gakusei; : 頻度を算出 tables height*seibetsu; : 二変量の組合わせで format height clheight.; : 連続変量をグループ化 run; : : proc sort data=gakusei; : 並べ替え by seibetsu; : 性別で run; : proc freq data=gakusei; : 頻度を算出 : 上記とほぼ同じ結果になる tables height; : 一変量ごとで format height clheight.; : 連続変量をグループ化 by seibetsu; : 性別で run; :
SAS システム 2 11:58 Wednesday, June 20, 2001 Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- -149 4 2.0 4 2.0 150-159 22 11.2 26 13.3 160-169 68 34.7 94 48.0 170-179 87 44.4 181 92.3 180- 15 7.7 196 100.0 Frequency Missing = 9 SAS システム 3 11:58 Wednesday, June 20, 2001 TABLE OF HEIGHT BY SEIBETSU HEIGHT SEIBETSU Frequency| Percent | Row Pct | Col Pct |F |M | Total ---------+--------+--------+ -149 | 4 | 0 | 4 | 2.04 | 0.00 | 2.04 | 100.00 | 0.00 | | 7.27 | 0.00 | ---------+--------+--------+ 150-159 | 21 | 1 | 22 | 10.71 | 0.51 | 11.22 | 95.45 | 4.55 | | 38.18 | 0.71 | ---------+--------+--------+ 160-169 | 29 | 39 | 68 | 14.80 | 19.90 | 34.69 | 42.65 | 57.35 | | 52.73 | 27.66 | ---------+--------+--------+ 170-179 | 1 | 86 | 87 | 0.51 | 43.88 | 44.39 | 1.15 | 98.85 | | 1.82 | 60.99 | ---------+--------+--------+ 180- | 0 | 15 | 15 | 0.00 | 7.65 | 7.65 | 0.00 | 100.00 | | 0.00 | 10.64 | ---------+--------+--------+ Total 55 141 196 28.06 71.94 100.00 Frequency Missing = 9 SAS システム 9 11:58 Wednesday, June 20, 2001 ----------------------------- SEIBETSU=' ' ----------------------------- Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- Frequency Missing = 2 SAS システム 10 11:58 Wednesday, June 20, 2001 ------------------------------ SEIBETSU=F ------------------------------ Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- -149 4 7.3 4 7.3 150-159 21 38.2 25 45.5 160-169 29 52.7 54 98.2 170-179 1 1.8 55 100.0 Frequency Missing = 4 SAS システム 11 11:58 Wednesday, June 20, 2001 ------------------------------ SEIBETSU=M ------------------------------ Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- 150-159 1 0.7 1 0.7 160-169 39 27.7 40 28.4 170-179 86 61.0 126 89.4 180- 15 10.6 141 100.0 Frequency Missing = 3
/* Lesson 10-3 */ /* File Name = les1003.sas 06/21/01 */ data gakusei; infile 'all01.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 09:40 Wednesday, June 20, 2001 ---------------------------------------------------------------------- | | HEIGHT | | |---------------------------------------------------| | | -149 | 150-159 | 160-169 | | |------------+-------------------------+------------| | | SEIBETSU | SEIBETSU | SEIBETSU | | |------------+-------------------------+------------| | | F | F | M | F | |----------------+------------+------------+------------+------------| |WEIGHT |N | 3.00| 14.00| 1.00| 17.00| | |--------+------------+------------+------------+------------| | |MEAN | 41.67| 48.79| 61.00| 51.53| | |--------+------------+------------+------------+------------| | |STD | 3.51| 4.32| .| 2.90| ---------------------------------------------------------------------- (CONTINUED) SAS システム 3 09:40 Wednesday, June 20, 2001 ---------------------------------------------------------------------- | | HEIGHT | | |---------------------------------------------------| | | 160-169 | 170-179 | 180- | | |------------+-------------------------+------------| | | SEIBETSU | SEIBETSU | SEIBETSU | | |------------+-------------------------+------------| | | M | F | M | M | |----------------+------------+------------+------------+------------| |WEIGHT |N | 39.00| 0.00| 86.00| 15.00| | |--------+------------+------------+------------+------------| | |MEAN | 58.55| .| 63.40| 66.87| | |--------+------------+------------+------------+------------| | |STD | 7.03| .| 7.26| 8.92| ----------------------------------------------------------------------