±¹¹Î³ëÈĺ¸ÀåÆгÎÁ¶»ç¿¡¼´Â 1~7Â÷³âµµ °³ÀÎ µ¥ÀÌÅ͸¦ ȾÀ¸·Î ¸ÓÁöÇÑ µ¥ÀÌÅÍ(KReISPW)¸¦ Á¦°øÇÏ°í ÀÖ´Ù. ÀÌ °æ¿ì °¢ Â÷¼ö º°·Î ÇÊ¿äÇÑ º¯¼ö¸¦ ÃßÃâÇÑ ÈÄ pid¸¦ ±âÁغ¯¼ö·Î Á¤·ÄÇÑ µÚ merge ÇÑ´Ù.
¿¹¸¦ µé¾î 1~7Â÷³âµµ °³ÀÎÀڷḦ ȾÀ¸·Î ¸ÓÁöÇÏ´Â °æ¿ì, ´ÙÀ½°ú °°Àº ÀýÂ÷¸¦ µû¸¥´Ù.
¨ç 1~7Â÷³âµµ °¡±¸ÀÚ·á¿¡¼ °¢°¢ ÇÊ¿äÇÑ º¯¼ö¸¦ ÃßÃâÇÑ´Ù.
¨è ±âÁغ¯¼ö °³ÀιøÈ£(pid)·Î Á¤·ÄÇÑ´Ù.
¨é °³ÀιøÈ£(pid)¸¦ ±âÁØÀ¸·Î mergeÇÑ´Ù.
/* sas Merge¹® È°¿ë */
data p01; set k.kreisp01;
keep pid p01a001 p01a002 p01a003;
run;
proc sort; by pid; run;
data p02; set k.kreisp02;
keep pid p02a001 p02a002 p02a003;
run;
proc sort; by pid; run;
data p03; set k.kreisp03;
keep pid p03a001 p03a002 p03a003; run;
proc sort; by pid; run;
data p04; set k.kreisp04;
keep pid p04a001 p04a002 p04a003; run;
proc sort; by pid; run;
data p05; set k.kreisp05;
keep pid p05a001 p05a002 p05a003; run;
proc sort; by pid; run;
data p06; set k.kreisp06;
keep pid p06a001 p06a002 p06a003; run;
proc sort; by pid; run;
data p07; set k.kreisp07;
keep hid w01hid w02hid w03hid w04hid w05hid w06hid w07hid pid hos pos pent w01psvy w02psvy w03psvy w04psvy w05psvy w06psvy w07psvy p07a001 p07a002 p07a003; run;
proc sort; by pid; run;
data pw;
retain hid w01hid w02hid w03hid w04hid w05hid w06hid w07hid pid hos pos pent w01psvy w02psvy w03psvy w04psvy w05psvy w06psvy w07psvy p01a001 p01a002 p01a003 p02a001 p02a002 p02a003 p03a001 p03a002 p03a003 p04a001 p04a002 p04a003 p05a001 p05a002 p05a003 p06a001 p06a002 p06a003 p07a001 p07a002 p07a003;
merge p01 p02 p03 p04 p05 p06 p07;
by pid; run;
/* spss Match¹® È°¿ë */
get file='D:\KReIS\SPSS\kreisp01.sav'
/keep=pid p01a001 p01a002 p01a003.
sort cases by pid.
save out ='D:\KReIS\SPSS\p01.sav'.
get file='D:\KReIS\SPSS\kreisp02.sav'
/keep=pid p02a001 p02a002 p02a003.
sort cases by pid.
save out ='D:\KReIS\SPSS\p02.sav'.
get file='D:\KReIS\SPSS\kreisp03.sav'
/keep=pid p03a001 p03a002 p03a003.
sort cases by pid.
save out ='D:\KReIS\SPSS\p03.sav'.
get file='D:\KReIS\SPSS\kreisp04.sav'
/keep=pid p04a001 p04a002 p04a003.
sort cases by pid.
save out ='D:\KReIS\SPSS\p04.sav'.
get file='D:\KReIS\SPSS\kreisp05.sav'
/keep=pid p05a001 p05a002 p05a003.
sort cases by pid.
save out ='D:\KReIS\SPSS\p05.sav'.
get file='D:\KReIS\SPSS\kreisp06.sav'
/keep=pid p06a001 p06a002 p06a003.
sort cases by pid.
save out ='D:\KReIS\SPSS\p06.sav'.
get file='D:\KReIS\SPSS\kreisp07.sav'
/keep=hid w01hid w02hid w03hid w04hid w05hid w06hid w07hid pid hos pos pent w01psvy w02psvy w03psvy w04psvy w05psvy w06psvy w07psvy p07a001 p07a002 p07a003.
sort cases by pid.
save out ='D:\KReIS\SPSS\p07.sav'.
match files /file='D:\KReIS\SPSS\p01.sav'
/file='D:\KReIS\SPSS\p02.sav'
/file='D:\KReIS\SPSS\p03.sav¡¯
/file=¡¯D:\KReIS\SPSS\p04.sav¡¯
/file=¡¯D:\KReIS\SPSS\p05.sav¡¯
/file=¡¯D:\KReIS\SPSS\p06.sav¡¯
/file=¡¯D:\KReIS\SPSS\p07.sav¡¯
/by pid.
save out ='D:\KReIS\SPSS\pw.sav'.
get file='D:\KReIS\SPSS\pw.sav'
/keep=hid w01hid w02hid w03hid w04hid w05hid w06hid w07hid pid hos pos pent w01psvy w02psvy w03psvy w04psvy w05psvy w06psvy w07psvy p01a001 p01a002 p01a003 p02a001 p02a002 p02a003 p03a001 p03a002 p03a003 p04a001 p04a002 p04a003 p05a001 p05a002 p05a003 p06a001 p06a002 p06a003 p07a001 p07a002 p07a003.
save out ='D:\KReIS\SPSS\pw.sav'.
/* stata Merge¹® È°¿ë */
use "D:\KReIS\STATA\kreisp01.dta", clear
keep pid p01a001 p01a002 p01a003
sort pid
save "D:\KReIS\STATA\p01.dta", replace
use "D:\KReIS\STATA\kreisp02.dta", clear
keep pid p02a001 p02a002 p02a003
sort pid
save "D:\KReIS\STATA\p02.dta", replace
use "D:\KReIS\STATA\kreisp03.dta", clear
keep pid p03a001 p03a002 p03a003
sort pid
save "D:\KReIS\STATA\p03.dta", replace
use "D:\KReIS\STATA\kreisp04.dta", clear
keep pid p04a001 p04a002 p04a003
sort pid
save "D:\KReIS\STATA\p04.dta", replace
use "D:\KReIS\STATA\kreisp05.dta", clear
keep pid p05a001 p05a002 p05a003
sort pid
save "D:\KReIS\STATA\p05.dta", replace
use "D:\KReIS\STATA\kreisp06.dta", clear
keep pid p06a001 p06a002 p06a003
sort pid
save "D:\KReIS\STATA\p06.dta", replace
use "D:\KReIS\STATA\kreisp07.dta", clear
keep hid w01hid w02hid w03hid w04hid w05hid w06hid w07hid pid hos pos pent w01psvy w02psvy w03psvy w04psvy w05psvy w06psvy w07psvy p07a001 p07a002 p07a003
sort pid
save "D:\KReIS\STATA\p07.dta", replace
use "D:\KReIS\STATA\p01.dta", clear
merge pid using "D:\KReIS\STATA\p02.dta" "D:\KReIS\STATA\p03.dta" "D:\KReIS\STATA\p04.dta" "D:\KReIS\STATA\p05.dta" "D:\KReIS\STATA\p06.dta" "D:\KReIS\STATA\p07.dta", unique sort
keep hid w01hid w02hid w03hid w04hid w05hid w06hid w07hid pid hos pos pent w01psvy w02psvy w03psvy w04psvy w05psvy w06psvy w07psvy p01a001 p01a002 p01a003 p02a001 p02a002 p02a003 p03a001 p03a002 p03a003 p04a001 p04a002 p04a003 p05a001 p05a002 p05a003 p06a001 p06a002 p06a003 p07a001 p07a002 p07a003
order hid w01hid w02hid w03hid w04hid w05hid w06hid w07hid pid hos pos pent w01psvy w02psvy w03psvy w04psvy w05psvy w06psvy w07psvy p01a001 p01a002 p01a003 p02a001 p02a002 p02a003 p03a001 p03a002 p03a003 p04a001 p04a002 p04a003 p05a001 p05a002 p05a003 p06a001 p06a002 p06a003 p07a001 p07a002 p07a003
save "D:\KReIS\STATA\pw.dta", replace