data rei01; do i=1 to 200; x=rannor(12345); output; end; run;
proc print data=rei01(firstobs=91 obs=110); run;
proc means data=rei01(firstobs=91 obs=110); run;
data _null_; set rei01; file "unsort.dat"; put i 5. x 15.8; run;
/* Lesson 19-1 */ /* File Name = les1901.sas 11/30/00 */ options linesize=72; /* pagesize=20; */ data rei01; do i=1 to 200; x=rannor(12345); output; end; run; proc print data=rei01(obs=10); run; proc means data=rei01; run; proc print data=rei01(firstobs=91 obs=110); run; proc means data=rei01(firstobs=91 obs=110); run; data _null_; set rei01; file "unsorted.dat"; put i 5. x 15.8; run; proc sort data=rei01; by x; run; proc print data=rei01(obs=10); run; proc print data=rei01(firstobs=91 obs=110); run; proc means data=rei01(firstobs=91 obs=110); run; data _null_; set rei01; file "sorted.dat"; put i 5. x 15.8; run;
title "Default"; proc chart data=rei02; hbar x; run; title "Ascending order"; proc chart data=rei02; hbar x / midpoints=-3 to 3 by .5; run; title "Descending order"; proc chart data=rei02; hbar x / midpoints=3 to -3 by -.5; run;
title "Default"; proc freq data=rei02; tables x10; run; title "Freqency order"; proc freq data=rei02 order=freq; tables x10; run; proc sort data=rei02; by decending x10; run; title "Descending order"; proc freq data=rei02 order=data; tables x10; run;
/* Lesson 19-2 */
/* File Name = les1902.sas 11/30/00 */
options linesize=72; /* pagesize=20; */
data rei02;
do i=1 to 100;
x=rannor(23456);
x10=int(x*10);
output;
end;
run;
title "Default";
proc chart data=rei02;
hbar x;
run;
title "Ascending order";
proc chart data=rei02;
hbar x / midpoints=-3 to 3 by .5;
run;
title "Descending order";
proc chart data=rei02;
hbar x / midpoints=3 to -3 by -.5;
run;
title "Default";
proc freq data=rei02;
tables x10;
run;
title "Freqency order";
proc freq data=rei02 order=freq;
tables x10;
run;
proc sort data=rei02;
by decending x10;
run;
title "Descending order";
proc freq data=rei02 order=data;
tables x10;
run;
[参考] : 数値関数
arcos : 逆余弦(アークコサイン)を算出します。
arsin : 逆正弦(アークサイン)を算出します。
atan : 逆正接(アークタンジェント)を算出します。
cos : 三角関数の余弦(コサイン)を求めます。
cosh : 双曲線の余弦(コサイン)を求めます。
sin : 正弦(サイン)を算出します。
sinh : 双曲線正弦を算出します。
tan : 正接(タンジェント)を算出します。
tanh : 双曲線正接の値を算出します。
ceil : 引数より大きいかまたは等しい整数のう最小の値を戻します。
floor : 引数値より小さいかまたは等しい整数値のうち最大のものを戻します。
fuzz : 引数と最も近い整数との差が10^-12以内のときに、その整数を戻します。
int : 小数部を切り捨てて、整数値を戻します。
round : 四捨五入します。
tranc : 指定された長さに切り捨てた数値を戻します。
data rei03;
infile 'data03.dat'
obs=10000
truncover
lrecl=530;
input
kamoku $ 2
kesseki $ 3
k_code $ 10-11
t_score 12-14
s_scor01 103-104
s_scor02 105-106
s_scor03 107-108
s_scor04 109-110
;
s_tot=s_scor01+s_scor02+s_scor03+s_scor04;
if kamoku^='2' then delete; /* Suugaku */ if kesseki^='0' then delete; /* delete of Kesseki-sya */ if k_code^='M1' then delete; /* Suugaku-1 only */
data rei04; infile 'seito.prn'; input koku $ suu1 $ suu2 $ tireki $ koumin $ rika $ ; if tireki="世界史-0" then tireki="世界史"; if tireki="世界史-2" then tireki="世界史"; if tireki="世界史-3" then tireki="世界史"; if tireki="地理-2" then tireki="地理"; if tireki="日本史-2" then tireki="日本史"; if tireki="日本史-3" then tireki="日本史"; if tireki="日本史-4" then tireki="日本史"; ...
if tireki="世界史-0" then do;
tireki="世界史";
koumin=.;
end;
...