/*データの読み込み:ドライブをxドライブを利用するものとしています。適宜修正してください*/ libname mylib "x:\sasw" ; DATA mylib.plpidx; infile 'x:\sasw\SAS_AnalysisData.txt' dlm='",' missover LRECL=1500 ; input ID Ken Yoto price1 price2 sq rw kenpei yosek ts UDIS cpcode gesui sui gas UX UY YearD tanka price area Rw ts tt cp1-cp7 tm1-tm34 UXX UYY ; run; /*ダミー変数の作成1:大規模データの時には時間がかなりかかります*/ proc transreg data=mylib.plpidx design; model class(ken yearD/ zero=sum) identity(area rw price); output out=out(drop=_TYPE_ _NAME_); run; /*ダミー変数の作成2:適宜,ダミー変数の数を指定していかなければなりません*/ data work.plpidxp ; set mylib.plpidx; array temp_ken ken1-ken47; array temp_year yearD1975-yearD2008; set mylib.plpidx; do i=1 to dim(temp_ken); if ken=i then temp_ken{i}=1; else temp_ken{i}=0; end; do i=1 to dim(temp_year); if yearD=i+1974 then temp_year{i}=1; else temp_year{i}=0; end; drop i; run; /*全体・記述統計量の計算1*/ PROC means DATA = work.plpidxp ; var tanka price area Rw ts tt; run; /*全体・記述統計量の計算2*/ PROC univariate DATA = work.plpidxp ; var tanka price area Rw ts tt; run; /*回帰分析:*/ PROC REG DATA = work.plpidxp; MODEL price=yearD1976-yearD2008 ken2-ken47 area rw ts tt gesui sui gas UX UY UXX UYY cp1 cp3 cp6 cp7 ; run; quit;