Stata

stata 결과 엑셀에 붙여넣기(내보내기) 여러가지 방법

visualy 2016. 11. 8. 14:31

1. 가장 간단한 방법  "copy table"

 

결과에서 복사할 결과를 드래그로 선택한 다음

오른쪽 버튼 클릭,

“Copy Table” 선택

엑셀에서 붙여넣기

 

2. estout 사용

estout 패키지 내 estpost를 사용해 tabstat을 사용한 교차표도 가능

* estout 설치
ssc install estout

* 그룹별 통계량 계산
estpost tabstat price mpg weight, statistics(mean sd min max) by(foreign)

* 결과를 엑셀로 내보내기
estout using summary_statistics.xlsx, replace cells("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) max(fmt(3))")

 

 

3. outreg2 사용

튜토리얼 : https://libguides.princeton.edu/outreg2

(본 글의 댓글 참조)

 

4. putexcel 사용 (stata 기본기능)

 

5. collapse 사용

댓글 참조.

Stata에는 preserve와 restore 명령어가 있어서, collapse 명령어 전에 원본 데이터를 잠시 보관하고 나중에 되돌릴 수 있습니다.

* 원본 데이터 보존
preserve

* 데이터 축소 (collapse)
collapse (mean) var1 var2 var3, by(group_var)

* 데이터 되돌리기
restore