±¹¹Î³ëÈĺ¸ÀåÆгÎÀÇ °æ¿ì °³ÀÎÁ¶»ç´ë»óÀÚ´Â 50¼¼ ÀÌ»óÀ̹ǷΠ50¼¼ ÀÌÇÏÀÎ °¡±¸¿øÀÇ Æ¯¼ºÀº °¡±¸ÀÚ·á¿¡¼ È®ÀÎÇÒ ¼ö ÀÖ´Ù. ÀÌ·¯ÇÑ Á¤º¸µéÀº ±¹¹Î³ëÈĺ¸ÀåÆгÎÆÀ¿¡¼ °¡°øÇÏ¿© ¡®ÀÎÀûÁ¤º¸µ¥ÀÌÅÍ¡¯ÇüÅ·ΠÁ¦°øÇÏ°í ÀÖ´Ù. µû¶ó¼ °¡±¸Àڷᳪ °³ÀÎÀÚ·á¿¡¼ °¡±¸¿øÀÇ Á¤º¸°¡ ÇÊ¿äÇÑ °æ¿ì °¡±¸µ¥ÀÌÅÍ¿¡¼ °¡±¸¿øÀÇ Á¤º¸¸¦ ÆľÇÇÏ¸é µÈ´Ù.
±×·¯³ª ¿¬±¸ÁÖÁ¦³ª »óȲ¿¡ µû¶ó °¡±¸¿øÀÇ ÀÎÀû Á¤º¸ Ư¼ºÀÌ ÇÊ¿äÇÑ °æ¿ì°¡ ¹ß»ýÇÒ ¼ö ÀÖÀ¸¸ç, ÀÌ °æ¿ì¿¡´Â ÀÚ·áÀÇ ÀûÀýÇÑ Á¶ÀÛÀÌ ÇÊ¿äÇÏ°Ô µÈ´Ù. À̶§¿¡´Â °¡±¸¹øÈ£¸¦ ±âÁØÀ¸·Î ¸ðµç °¡±¸¿øÀÇ Æ¯¼ºÀÌ È¾À¸·Î ºÙ¾îÀÖ´Â µ¥ÀÌÅ͸¦ °¡±¸¿øÀÇ pid¿¡ µû¶ó °³Àε¥ÀÌÅÍ¿Í °°ÀÌ ¿·Î ¹Ù²Ù¾îÁÖ´Â °ÍÀÌ ÇÊ¿äÇÏ°Ô µÈ´Ù. ¸¸¾à 7Â÷³âµµ °¡±¸¿¡ ¼ÓÇÑ ¸ðµç °¡±¸¿øÀÇ ¼ºº°, °¡±¸ÁÖ¿ÍÀÇ °ü°è, ¿¬·ÉÀ» °¡Áö°í À̵éÀÇ Æ¯¼ºÀ» ºÐ¼®ÇÒ °æ¿ì ´ÙÀ½°ú °°Àº ÀýÂ÷¸¦ µû¸£¸é µÈ´Ù. À̶§ ±âÁ¸¿¡´Â °¡±¸¿øÀ̾úÀ¸³ª, 7Â÷³âµµ Á¶»ç½ÃÁ¡¿¡ Å»¶ôÇÑ °¡±¸¿øÀÇ °æ¿ì pid´Â ³²¾ÆÀÖÀ¸³ª °¡±¸¿ø Á¤º¸¿Í °ü·ÃµÈ º¯¼ö´Â °áÃø󸮵Ǿî ÀÖÀ¸¹Ç·Î »ç¿ë¿¡ À¯ÀÇÇÏ±æ ¹Ù¶õ´Ù.
/* sas transpose ¹®ÀÇ È°¿ë*/
data a1;set k.kreish07;
if w07hsvy^=1 then delete; /*7Â÷ÀÚ·á¿¡ ÀÀ´äÇÑ ÄÉÀ̽º¸¸ ÃßÃâ*/
proc sort; by w07hid; run; /*7Â÷ °¡±¸¹øÈ£·Î Á¤·Ä*/
/*7Â÷ °¡±¸¹øÈ£¸¦ ±âÁØÀ¸·Î ÇàÀ» ¿·Î Àüȯ*/
proc transpose data=a1
out=trans1(rename=(col1=pid));
by w07hid;
var pid01 pid02 pid03 pid04 pid05 pid06 pid07 pid08 pid09;
proc transpose data=a1
out=trans2(rename=(col1=sex));
by w07hid;
var sex01 sex02 sex03 sex04 sex05 sex06 sex07 sex08 sex09;
proc transpose data=a1
out=trans3(rename=(col1=rel));
by w07hid;
var rel01 rel02 rel03 rel04 rel05 rel06 rel07 rel08 rel09;
proc transpose data=a1
out=trans4(rename=(col1=age));
by w07hid;
var age01 age02 age03 age04 age05 age06 age07 age08 age09;
data a2;
merge trans1 trans2 trans3 trans4; /*pid, sex, rel, age º¯¼ö ȾÀ¸·Î ºÙÀ̱â*/
by w07hid; /*7Â÷ °¡±¸¹øÈ£·Î Á¤·Ä*/
if pid=. then delete; /*pid°¡ ¾ø´Â °æ¿ì »èÁ¦*/
drop _name_ _label_; run; /*Àüȯ°úÁ¤¿¡¼ ¸¸µé¾îÁø ÇÊ¿ä¾ø´Â º¯¼ö »èÁ¦*/
/* spss vastocases¹®ÀÇ È°¿ë*/
get file='D:\KReIS\SPSS\kreish07.sav'.
select if (w07hsvy = 1). /*7Â÷ÀÚ·á¿¡ ÀÀ´äÇÑ ÄÉÀ̽º¸¸ ÃßÃâ*/
sort cases by w07hid. /*7Â÷ °¡±¸¹øÈ£·Î Á¤·Ä*/
/*7Â÷ °¡±¸¹øÈ£¸¦ ±âÁØÀ¸·Î ÇàÀ» ¿·Î Àüȯ*/
varstocases
/make pid from pid01 pid02 pid03 pid04 pid05 pid06 pid07 pid08 pid09
/make sex from sex01 sex02 sex03 sex04 sex05 sex06 sex07 sex08 sex09
/make rel from rel01 rel02 rel03 rel04 rel05 rel06 rel07 rel08 rel09
/make age from age01 age02 age03 age04 age05 age06 age07 age08 age09
/index=index1(10)
/keep =w07hid
/null =keep.
select if pid~=sysmis(pid). /*pid°¡ ¾ø´Â °æ¿ì »èÁ¦*/
exe.
save out ='D:\KReIS\SPSS\a2.sav'.
/* stata reshape¹®ÀÇ È°¿ë*/
clear
set mem 300m
use "D:\KReIS\STATA\kreish07.dta", clear
drop if w07hsvy~=1 /*7Â÷ÀÚ·á¿¡ ÀÀ´äÇÑ ÄÉÀ̽º¸¸ ÃßÃâ*/
keep w07hid pid01-pid09 sex01-sex09 rel01-rel09 age01-age09
local a=1
foreach pid of varlist pid01-pid09 {
rename `pid' pid`a'
local ++a
}
local b=1
foreach sex of varlist sex01-sex09 {
rename `sex' sex`b'
local ++b
}
local k=1
foreach rel of varlist rel01-rel09 {
rename `rel' rel`k'
local ++k
}
local l=1
foreach age of varlist age01-age09 {
rename `age' age`l'
local ++l
}
reshape long pid sex rel age, i(w07hid) j(ind) /*7Â÷ °¡±¸¹øÈ£¸¦ ±âÁØÀ¸·Î ÇàÀ» ¿·Î Àüȯ*/
drop if pid==.
save "D:\KReIS\STATA\a2.dta", replace