BookmarkSubscribeRSS Feed

[기초부터 배우는 SAS Programing] 13. TABULATE Procedure

Started ‎06-15-2020 by
Modified ‎06-15-2020 by
Views 734

1.PNG

 

 

PROC TABULATE

요약통계량 테이블을 작성하는 프로시저입니다

PROC TABULATE DATA=SAS-data-set option(s);
   CLASS variables; <- 범주형 변수
   VAR variables; <- 분석벽수 통계량 구할 수 있는 변수(숫자변수)
   TABLE table description;
RUN;

- 분석변수는 따로 지정이 없으면 관측치 갯수의 합계가 주어짐

 

** TABLE DESCRIPTIOIN 

①  (blank) : table과 table을 동등하게 연결

② , (comma) : 차원변경 ( row -> column)

③ * (asterisk) : nested table 작성

 

1. CLASS Statement

 

  ① One-way

2.PNG

-> N ( in 출력화면) : class별 인원수

-> ALL : 마지막 행(또는 열)에 합계를 나타내는 행(또는 열)을 추가하는 키위드

 

  ② Two-way

3.PNG

 

   ③ Two-way with WHERE Statement

4.PNG

-> WHERE 문장 : 선택한 행만 테이블 작성

 

2. CLASS Statement & VAR Statement

 

   ① One-way

5.PNG

 

  ② Two-way

6.PNG

 

※ TABLE문장에서는 row 선언 후 column 선언

ex)  table class,sex; <- class는 row로, sex는 column으로 선언

 

 

③ Two-way with WHERE Statement

7.PNG

 

 ** 각 반별, 나이별, 성별 점수 평균

proc tabulate data=student;
  class class sex age;
  var score;
  table class*age all*(age all)
         ,sex*(n score*mean) all*(n score*mean); 
run;

 table class*age all*(age all)

                    -> Row : 각 반의 나이별 인원수와 점수 평균, 마지막에 각 반의 나이별 인원수와 평균 나타내는 행 추가

           ,sex*(n score*mean) all*(n score*mean);

                    -> Column : 각 반의 성별 인원수와 점수 평균, 마지막에 각 성별에 따라 나이별 인원수와 평균 나타내는 열 추가

 

8.PNG

Version history
Last update:
‎06-15-2020 05:22 AM
Updated by:
Contributors

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Article Labels
Article Tags