¿¹¸¦ µé¾î 7Â÷³âµµ °¡±¸ÀÚ·á¿Í °³ÀÎÀڷḦ ÇÕÄ¡´Â °æ¿ì, ´ÙÀ½°ú °°Àº ÀýÂ÷¸¦ µû¸¥´Ù.
¨ç 7Â÷³âµµ °¡±¸ÀÚ·á¿Í 7Â÷³âµµ °³ÀÎÀÚ·á¿¡´Â 1Â÷ºÎÅÍ ÀÀ´äÇÑ ¸ðµç ÄÉÀ̽ºµéÀÌ Æ÷ÇԵǾî ÀÖÀ¸¹Ç·Î, 7Â÷³âµµ ÀÚ·á¿¡¸¸ ÀÀ´äÇÑ ÄÉÀ̽ºµéÀ» ÃßÃâÇÒ ÇÊ¿ä°¡ ÀÖ´Ù. Á¶»çÂü¿©¿©ºÎ º¯¼ö(°¡±¸ÀÚ·áÀÇ °æ¿ì w07hsvy, °³ÀÎÀÚ·áÀÇ °æ¿ì w07psvy)°ªÀÌ 1ÀÎ ÄÉÀ̽º¸¦ ÃßÃâÇÑ´Ù.
¨è 7Â÷³âµµ °¡±¸ÀÚ·á¿Í 7Â÷³âµµ °³ÀÎÀڷḦ °¢°¢ w07hid¸¦ ±âÁØÀ¸·Î Á¤·Ä(sort)ÇÑ´Ù.
¨é 7Â÷³âµµ °¡±¸¹øÈ£(w07hid)¸¦ ±âÁØÀ¸·Î mergeÇÑ´Ù.
/* sas merge¹®ÀÇ È°¿ë*/
clear
set mem 300m
use "D:\KReIS\STATA\kreisp07.dta", clear
keep if w07psvy==1 /*7Â÷¿¡ ÀÀ´äÇÑ °³Àε鸸 ÃßÃâ*/
gen base=.
keep pid w07psvy p07g036 p07g039 p07g042 p07g045 p07g048 base
local k=1 /*»çȸº¸Àå±Þ¿©Á¾·ù 1-5 Á¤·Ä*/
foreach g of varlist p07g036-p07g048 {
rename `g' g`k'
local ++k
}
foreach n of num 1/5 {
replace base=g`n' if g`n'==162
} /*±âÃÊ¿¬±Ý(ºÎºÎ) ¼ö±ÞÀÚ¸¦ ÃßÃâ*/
save "D:\KReIS\STATA\a.dta", replace
data a;
set k.kreish07; where w07hsvy=1;
proc sort; by w07hid; run;
data a1;
set k.kreisp07; where w07psvy=1;
proc sort; by w07hid; run;
data a2;
merge a a1; by w07hid; if pid^=.; run;
/* spss match¹®ÀÇ È°¿ë*/
get file='D:\KReIS\SPSS\kreish07.sav'.
select if (w07hsvy = 1).
sort cases by w07hid.
save out='D:\KReIS\SPSS\a.sav'.
exe.
get file='D:\KReIS\SPSS\kreisp07.sav'.
select if (w07psvy = 1).
sort cases by w07hid.
save out='D:\KReIS\SPSS\a1.sav'.
exe.
match files /file=*
/table='D:\KReIS\SPSS\a.sav'
/by w07hid.
exe.
save out='D:\KReIS\SPSS\a2.sav'
compressed.
/* stata merge¹®ÀÇ È°¿ë*/
clear
set mem 300m
use "D:\KReIS\STATA\kreish07.dta", clear
keep if w07hsvy==1
sort w07hid
save "D:\KReIS\STATA\a.dta", replace
use "D:\KReIS\STATA\kreisp07.dta", clear
keep if w07psvy==1
sort w07hid
merge w07hid using "D:\KReIS\STATA\a.dta", uniqusing
keep if pid~=.
save "D:\KReIS\STATA\a2.dta", replace