BookmarkSubscribeRSS Feed

[SAS 프로그래밍 고수 백승민] [회귀분석] 독립변수 자동화 및 ODS 통계량 저장

Started ‎06-11-2020 by
Modified ‎06-11-2020 by
Views 115

* 후배가 회귀분석을 하는데 출력 결과를 하나 하나 복사하여서 엑셀로 붙이는 작업을 하고 있어서
  적어서 보내준 글입니다.
  참고하시기를.. 

http://www.technion.ac.il/docs/sas/stat/chap55/sect48.htm
http://www.ats.ucla.edu/stat/sas/faq/bootstrap.htm
* 데이터 구조 파악 및 변수 순서 출력 : http://cafe.daum.net/statsas/3F8j/93

 

DATA hsb25;
  INPUT id female race ses schtype $ prog
        read write math science socst;
DATALINES;
 147 1 1 3 pub 1 47  62  53  53  61
 108 0 1 2 pub 2 34  33  41  36  36
  18 0 3 2 pub 3 50  33  49  44  36
 153 0 1 2 pub 3 39  31  40  39  51
  50 0 2 2 pub 2 50  59  42  53  61
  51 1 2 1 pub 2 42  36  42  31  39
 102 0 1 1 pub 1 52  41  51  53  56
  57 1 1 2 pub 1 71  65  72  66  56
 160 1 1 2 pub 1 55  65  55  50  61
 136 0 1 2 pub 1 65  59  70  63  51
  88 1 1 1 pub 1 68  60  64  69  66
 177 0 1 2 pri 1 55  59  62  58  51
  95 0 1 1 pub 1 73  60  71  61  71
 144 0 1 1 pub 2 60  65  58  61  66
 139 1 1 2 pub 1 68  59  61  55  71
 135 1 1 3 pub 1 63  60  65  54  66
 191 1 1 1 pri 1 47  52  43  48  61
 171 0 1 2 pub 1 60  54  60  55  66
  22 0 3 2 pub 3 42  39  39  56  46
  47 1 2 3 pub 1 47  46  49  33  41
  56 0 1 2 pub 3 55  45  46  58  51
 128 0 1 1 pub 1 39  33  38  47  41
  36 1 2 3 pub 2 44  49  44  35  51
  53 0 2 2 pub 3 34  37  46  39  31
  26 1 4 1 pub 1 60  59  62  61  51
;
RUN;

 

* 문자변수 선택;
PROC CONTENTS DATA = hsb25
              OUT  = BACK;
RUN;

 

* 변수명에 대한 매크로 처리(Call Symput);
* http://cafe.daum.net/statsas/3F8j/38;
* http://cafe.daum.net/statsas/3Q3u/112;

 

ods output FitStatistics = back0 Corr=back1;
proc reg data=hsb25 corr;
  model write = female math; * 독립변수를 위의 매크로 변수를 사용;
run;
quit;
ods output close;

* 위 회귀분석 구분을 변수별로 매크로 처리하여서 back0와 back1의 값을 append 처리함;

Version history
Last update:
‎06-11-2020 05:14 AM
Updated by:
Contributors

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

Register now!

Article Labels
Article Tags