/*データの読み込み:ドライブをxドライブを利用するものとしています。適宜修正してください*/ Libname mylib "x:\sasw"; data mylib.PLP; infile 'x:\sasw\PublishLandPrice.txt' dlm='",' missover LRECL=1500 ; input id year local price sq rw ts tt td01-td65 ld01-ld35 south gas gw zone far; run; /*データの加工*/ data work.index; set mylib.PLP; if price = . then delete; if price >= 10000000 then delete; lprice=log(price/sq); lsq=log(sq+1); lrw=log(rw+1); lts=log(ts+1); ltt=log(tt+1); lfar=log(far+1); run ; /*要約統計量1*/ proc means data=work.index maxdec=3 /*Maxdec=3で小数点以下の出力を指定*/ n min max mean std var skewness kurtosis cv ; var price sq rw ts tt far ; run ; /*要約統計量2*/ proc univariate data=work.index; var price sq rw ts tt far; run; /*散布図1*/ title1 'Land Price v.s. Length of Station'; axis1 label=('Length of Station'); axis2 label=('Land Price'); proc gplot data=work.index; plot price*ts/haxis=axis1 vaxis=axis2; run; quit; /*散布図2*/ proc g3D data= work.index; scatter price*ts =far; run; quit; proc sort data=work.index; by local year; run ; /*回帰分析1:ステップワイズ*/ proc reg data=work.index; model lprice = lsq lrw lts ltt lfar td01-td65 ld01-ld35 /selection=stepwise include=69 slentry=0.10 slstay=0.15; run; /*回帰分析2:地域別ステップワイズ*/ proc reg data=work.index; model lprice = lsq lrw lts ltt lfar td01-td65 ld01-ld35 /selection=stepwise include=69 slentry=0.10 slstay=0.15; by local; run; quit ; /*回帰分析3:総当たり*/ proc reg data=work.index; model lprice = lsq lrw lts ltt lfar td01-td65 ld01-ld35 /selection=rsquare adjrsq cp b best=1 include=69; run;