/* Lesson 8-1 */ /* File Name = les0801.sas 06/24/99 */ data gakusei; infile 'all99.dat'; 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 19:57 Wednesday, June 23, 1999 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI 1 M 178 58.0 . J 20000 2 M 170 63.0 90 J 30000 3 M 167 56.0 . J 30000 4 M 172 61.5 . J 30000 5 M 170 52.0 . J 30000 6 F 156 . . J 30000 7 M 172 72.0 89 G 150000 8 M 163 51.0 82 J 10000 9 M 175 57.0 . G 70000 10 M 171 66.0 . G 80000 SAS システム 2 19:57 Wednesday, June 23, 1999 Analysis Variable : KODUKAI N Mean Std Dev Minimum Maximum ----------------------------------------------------------- 98 50219.39 50679.05 0 200000.00 ----------------------------------------------------------- SAS システム 3 19:57 Wednesday, June 23, 1999 Analysis Variable : KODUKAI ------------------------------- JITAKU=' ' ----------------------------- N Mean Std Dev Minimum Maximum ----------------------------------------------------------- 2 40000.00 14142.14 30000.00 50000.00 ----------------------------------------------------------- SAS システム 4 19:57 Wednesday, June 23, 1999 Analysis Variable : KODUKAI -------------------------------- JITAKU=G ------------------------------ N Mean Std Dev Minimum Maximum ----------------------------------------------------------- 34 104058.82 48252.46 0 200000.00 ----------------------------------------------------------- SAS システム 5 19:57 Wednesday, June 23, 1999 Analysis Variable : KODUKAI -------------------------------- JITAKU=J ------------------------------ N Mean Std Dev Minimum Maximum ----------------------------------------------------------- 62 21024.19 18326.37 0 80000.00 ----------------------------------------------------------- SAS システム 6 19:57 Wednesday, June 23, 1999 KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 15000 |********************* 42 42 42.86 42.86 45000 |************ 24 66 24.49 67.35 75000 |***** 9 75 9.18 76.53 105000 |**** 8 83 8.16 84.69 135000 |*** 5 88 5.10 89.80 165000 |***** 9 97 9.18 98.98 195000 |* 1 98 1.02 100.00 | -----+----+----+----+- 10 20 30 40 Frequency SAS システム 7 19:57 Wednesday, June 23, 1999 ------------------------------ JITAKU=' ' ------------------------------ KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 30000 |******************** 1 1 50.00 50.00 | 40000 | 0 1 0.00 50.00 | 50000 |******************** 1 2 50.00 100.00 | --------------------+ 1 Frequency SAS システム 8 19:57 Wednesday, June 23, 1999 ------------------------------- JITAKU=G ------------------------------- KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 0 |****** 3 3 8.82 8.82 40000 |**** 2 5 5.88 14.71 80000 |************ 6 11 17.65 32.35 120000 |************************** 13 24 38.24 70.59 160000 |****************** 9 33 26.47 97.06 200000 |** 1 34 2.94 100.00 | ----+---+---+---+---+---+-- 2 4 6 8 10 12 Frequency SAS システム 9 19:57 Wednesday, June 23, 1999 ------------------------------- JITAKU=J ------------------------------- KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 0 |****************** 18 18 29.03 29.03 15000 |**************** 16 34 25.81 54.84 30000 |******************** 20 54 32.26 87.10 45000 |***** 5 59 8.06 95.16 60000 |** 2 61 3.23 98.39 75000 |* 1 62 1.61 100.00 | -----+----+----+----+ 5 10 15 20 Frequency SAS システム 10 19:57 Wednesday, June 23, 1999 JITAKU KODUKAI Cum. Cum. Midpoint Freq Freq Percent Percent | 15000 | 0 0 0.00 0.00 45000 |* 2 2 2.04 2.04 75000 | 0 2 0.00 2.04 105000 | 0 2 0.00 2.04 135000 | 0 2 0.00 2.04 165000 | 0 2 0.00 2.04 195000 | 0 2 0.00 2.04 | G 15000 |** 3 5 3.06 5.10 45000 |* 2 7 2.04 7.14 75000 |*** 6 13 6.12 13.27 105000 |**** 8 21 8.16 21.43 135000 |*** 5 26 5.10 26.53 165000 |***** 9 35 9.18 35.71 195000 |* 1 36 1.02 36.73 | J 15000 |******************** 39 75 39.80 76.53 45000 |********** 20 95 20.41 96.94 75000 |** 3 98 3.06 100.00 105000 | 0 98 0.00 100.00 135000 | 0 98 0.00 100.00 165000 | 0 98 0.00 100.00 195000 | 0 98 0.00 100.00 | -----+----+----+----+ 10 20 30 40 Frequency
/* Lesson 8-2 */ /* File Name = les0802.sas 06/24/99 */ data gakusei; infile 'all99.dat'; 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 20:13 Wednesday, June 23, 1999 Cumulative Cumulative SEIBETSU Frequency Percent Frequency Percent ------------------------------------------------------ F 29 25.4 29 25.4 M 85 74.6 114 100.0 Frequency Missing = 1 Cumulative Cumulative JITAKU Frequency Percent Frequency Percent ---------------------------------------------------- G 37 36.3 37 36.3 J 65 63.7 102 100.0 Frequency Missing = 13 SAS システム 4 20:13 Wednesday, June 23, 1999 TABLE OF SEIBETSU BY JITAKU SEIBETSU JITAKU Frequency| Percent | Row Pct | Col Pct |G |J | Total ---------+--------+--------+ F | 3 | 20 | 23 | 2.94 | 19.61 | 22.55 | 13.04 | 86.96 | | 8.11 | 30.77 | ---------+--------+--------+ M | 34 | 45 | 79 | 33.33 | 44.12 | 77.45 | 43.04 | 56.96 | | 91.89 | 69.23 | ---------+--------+--------+ Total 37 65 102 36.27 63.73 100.00 Frequency Missing = 13
/* Lesson 8-3 */ /* File Name = les0803.sas 06/24/99 */ data gakusei; infile 'all99.dat'; 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-high='170- ' : 4 other ='missing'; : 5 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 20:24 Wednesday, June 23, 1999 Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- -149 2 1.9 2 1.9 150-159 12 11.1 14 13.0 160-169 35 32.4 49 45.4 170- 59 54.6 108 100.0 Frequency Missing = 7 SAS システム 3 20:24 Wednesday, June 23, 1999 ----------------------------- SEIBETSU=' ' ----------------------------- Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- Frequency Missing = 1 SAS システム 4 20:24 Wednesday, June 23, 1999 ------------------------------ SEIBETSU=F ------------------------------ Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- -149 2 8.0 2 8.0 150-159 11 44.0 13 52.0 160-169 11 44.0 24 96.0 170- 1 4.0 25 100.0 Frequency Missing = 4 SAS システム 5 20:24 Wednesday, June 23, 1999 ------------------------------ SEIBETSU=M ------------------------------ Cumulative Cumulative HEIGHT Frequency Percent Frequency Percent ----------------------------------------------------- 150-159 1 1.2 1 1.2 160-169 24 28.9 25 30.1 170- 58 69.9 83 100.0 Frequency Missing = 2 SAS システム 6 20:24 Wednesday, June 23, 1999 TABLE OF HEIGHT BY SEIBETSU HEIGHT SEIBETSU Frequency| Percent | Row Pct | Col Pct |F |M | Total ---------+--------+--------+ -149 | 2 | 0 | 2 | 1.85 | 0.00 | 1.85 | 100.00 | 0.00 | | 8.00 | 0.00 | ---------+--------+--------+ 150-159 | 11 | 1 | 12 | 10.19 | 0.93 | 11.11 | 91.67 | 8.33 | | 44.00 | 1.20 | ---------+--------+--------+ 160-169 | 11 | 24 | 35 | 10.19 | 22.22 | 32.41 | 31.43 | 68.57 | | 44.00 | 28.92 | ---------+--------+--------+ 170- | 1 | 58 | 59 | 0.93 | 53.70 | 54.63 | 1.69 | 98.31 | | 4.00 | 69.88 | ---------+--------+--------+ Total 25 83 108 23.15 76.85 100.00 Frequency Missing = 7
/* Lesson 8-4 */ /* File Name = les0804.sas 06/24/99 */ data gakusei; infile 'all99.dat'; input seibetsu $ height weight chest jitaku $ kodukai; proc format; value clheight low-<150=' -149' 150-<160='150-159' 160-<170='160-169' 170-high='170- ' 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 21:06 Wednesday, June 23, 1999 ---------------------------------------------------------------------- | | HEIGHT | | |---------------------------------------------------| | | -149 | 150-159 | 160-169 | | |------------+-------------------------+------------| | | SEIBETSU | SEIBETSU | SEIBETSU | | |------------+-------------------------+------------| | | F | F | M | F | |----------------+------------+------------+------------+------------| |WEIGHT |N | 1.00| 4.00| 1.00| 3.00| | |--------+------------+------------+------------+------------| | |MEAN | 38.00| 47.50| 61.00| 51.67| | |--------+------------+------------+------------+------------| | |STD | .| 3.87| .| 3.21| ---------------------------------------------------------------------- (CONTINUED) SAS システム 3 21:06 Wednesday, June 23, 1999 --------------------------------------------------------- | | HEIGHT | | |--------------------------------------| | | 160-169 | 170- | | |------------+-------------------------| | | SEIBETSU | SEIBETSU | | |------------+-------------------------| | | M | F | M | |----------------+------------+------------+------------| |WEIGHT |N | 24.00| 0.00| 58.00| | |--------+------------+------------+------------| | |MEAN | 59.97| .| 62.64| | |--------+------------+------------+------------| | |STD | 7.88| .| 6.12| ---------------------------------------------------------