본문으로 바로가기

연구제안 및 문의하기

함께하는 KLIPS, 소통하는 KLIPS, 열린 KLIPS

FAQ

가구소득을 구성하는 방법 - SAS Array문 활용 예 : 가구총소득 구성하기

  • Date2016.02.03
  • Hit2,701
노동패널 가구용 자료에서 조사되는 가구소득 항목은 ① 근로소득 ② 금융소득 ③ 부동산소득 ④ 사회보험 수혜금 ⑤ 이전소득 ⑥ 기타소득 이다.
여기서 주의할 점은 가구용 자료에 있는 소득들은 이미 가구 단위로 합산이 되어 있는 값이라는 점이다. 예를 들어 가구용 자료의 근로소득이란 근로소득이 있는 모든 가구원의 근로소득을 합한 값을 의미한다. 만일 연구자가 가구원 각각의 소득을 알고 싶다면, 개인용 자료에서 가구원 각각의 근로소득을 추출하여야 한다.

만일 가구의 총소득을 구하고자 할 때에는 6가지 항목별 소득을 모두 합산하면 된다. 다만, 근로소득을 제외한 다른 소득들은 다시 세분하여 질문하고 있으므로, 이들을 각각 합산하여야 한다. 예컨대 금융소득의 경우 ㉠ 은행 등 금융기관 이자/투자소득 ㉡ 사채 등 비금융기관 이자수입 ㉢ 주식/채권 매매차익 ㉣ 배당금 ㉤ 기타 로 구분되어 있으므로, 가구의 금융소득은 이들을 모두 합한 값이 된다.


*=======================================================*
* SAS 가구 총소득 구성하기 : Array 문 활용하기 *
*=======================================================*

/*13차부터 제도변화에 따라 근로장려세제를 추가로 질문하였음. 총가구소득시에는 이전소득으로 포함하여 계산함*/

data h19; set a.klips19h;

/*결측치 처리*/
array h[*] h192102 /*작년 한해 총 근로소득*/
h192112-h192116 /*작년 한해 총 금융소득*/
h192122-h192126 /*작년 한해 총 부동산소득*/
h192134 h192136 h192138 h192140 h192142 /*작년 한해 사회보험소득*/
h192152-h192160 /*작년 한해 총 이전소득*/
h192183-h192191 /*작년 한해 총 기타소득*/
h194002; /* 작년 한해 총 근로장려세제*/
do i=1 to dim(h);
if h[i]=-1 then h[i]=.;
end;

/*항목별 소득총계*/
inc_e=h192102; /*earned income*/
inc_m=sum(of h192112-h192116); /*financial income*/
inc_p=sum(of h192122-h192126); /*real estate income*/
inc_i=sum(of h192134, h192136, h192138, h192140, h192142); /*social insurance*/
inc_t=sum(of h192152-h192160, h194002); /*transfer income*/
inc_o=sum(of h192183-h192191); /*other income*/

/*소득유무*/
inc_ey=h192101;
inc_my=h192111;
inc_py=h192121;
inc_iy=h192131;
inc_ty=0;
if h192151=1 or h194001=1 then inc_ty=1;
if h192151=2 and h194001=2 then inc_ty=2;
if inc_ty=0 then inc_ty=.;
inc_oy=h192181;

/*annual total income*/
inc=sum(of inc_e, inc_m, inc_p, inc_i, inc_t, inc_o);

proc freq; table inc_ey inc_my inc_py inc_iy inc_ty inc_oy;
proc univariate; var inc;
run;



*==================================.
* SPSS - 가구 총소득 구성하기 .
*==================================.

get file='D:\19차\users guide\19차년도\klips19h.sav'.

/*13차부터 제도변화에 따라 근로장려세제를 추가로 질문하였음. 총가구소득시에는 이전소득으로 포함하여 계산함*/
/* 결측치 처리 (transform → recode into same variables 메뉴 사용) */

RECODE
h192102 h192112 to h192116 h192122 to h192126 h192134 h192136 h192138 h192140 h192142 h192152 to h192160
h192183 to h192191 h194002(-1=SYSMIS) .
EXECUTE.

/*항목별 소득총계*/
compute inc_e=h192102. /*earned income*/
compute inc_m=sum(h192112 to h192116). /*financial income*/
compute inc_p=sum(h192122 to h192126). /*real estate income*/
compute inc_i=sum(h192134, h192136, h192138, h192140, h192142). /*social insurance*/
compute inc_t=sum(h192152 to h192160, h194002). /*transfer income*/
compute inc_o=sum(h192183 to h192191). /*other income*/

/*소득유무*/
compute inc_ey=h192101.
compute inc_my=h192111.
compute inc_py=h192121.
compute inc_iy=h192131.
compute inc_ty=0.
if(h192151=1 or h194001=1) inc_ty=1.
if(h192151=2 and h194001=2) inc_ty=2.
recode inc_ty (0=sysmis).
compute inc_oy=h192181.

/*annual total income*/
compute inc=sum(inc_e, inc_m, inc_p, inc_i, inc_t, inc_o).
execute.

fre inc_ey inc_my inc_py inc_iy inc_ty inc_oy.
des inc/stat=mean std min max.



/*======================================*/
/* stata - 가구 총소득 구성하기 */
/*======================================*/

/*13차부터 제도변화에 따라 근로장려세제를 추가로 질문하였음. 총가구소득시에는 이전소득으로 포함하여 계산함*/

/*결측치 처리*/
clear
use klips19h, clear
keep if hwave19==1
#delimit;
recode h192102 h192112-h192116 h192122-h192126
h192134 h192136 h192138 h192140 h192142
h192152-h192160 h192183-h192191 h194002 (-1=.);
#delimit cr

/*항목별 소득총계*/
gen inc_e=h192102 /*earned income*/
egen inc_m=rowtotal(h192112-h192116),missing /*financial income*/
egen inc_p=rowtotal(h192122-h192126),missing /*real estate income*/
egen inc_i=rowtotal(h192134 h192136 h192138 h192140 h192142),missing /*social insurance*/
egen inc_t=rowtotal(h192152-h192160 h194002),missing /*transfer income*/
egen inc_o=rowtotal(h192183-h192191),missing /*other income*/

/*소득유무*/
gen inc_ey=h192101
gen inc_my=h192111
gen inc_py=h192121
gen inc_iy=h192131
gen inc_ty=1 if h192151==1|h194001==1
replace inc_ty=2 if h192151==2&h194001==2
gen inc_oy=h192181

/*annual total income*/
egen inc=rowtotal(inc_e inc_m inc_p inc_i inc_t inc_o),mis

tab1 inc_ey inc_my inc_py inc_iy inc_ty inc_oy
sum inc





*==============================================#
* R – 가구 총소득 구성하기 #
*==============================================#

#결측치 처리
library(foreign)
h19 ← read.spss(file = "C:\\Users\\KLI\\DATA\\1-19spss\\klips19h.sav", use.value.labels = FALSE, to.data.frame = TRUE )
h19[h19== (-1)] ← NA

# 소득 계산
inc_e ← h19[ , "h192102"] # earned income
m ← select(h19,h192112:h192116)
inc_m ← rowSums(m , na.rm = TRUE) # financial income
p ← select(h19,h192122:h192126)
inc_p ← rowSums(p , na.rm = TRUE) # real estate income
i ← select(h19,h192134,h192136,h192138,h192140,h192142)
inc_i ← rowSums(i , na.rm = TRUE) # social insurance
t ← select(h19,h192152:h192160,h194002)
inc_t ← rowSums(t, na.rm = TRUE) # transfer income
o ← select(h19,h192183:h192191)
inc_o ← rowSums(o, na.rm = TRUE) # other income
inc_table ← data.frame(inc_e,inc_m,inc_p,inc_i,inc_t,inc_o)
inc_table # 하나의 데이터로 병합
inc_table$inc ← rowSums(inc_table[,1:6], na.rm=TRUE) # annual total income "inc"
inc_table$inc ← ifelse(inc_table$inc ==0 , NA, inc_table$inc)
inc_table

# 소득 유무
inc_ey ← select(h19,h192101)
inc_my ← select(h19,h192111)
inc_py ← select(h19,h192121)
inc_iy ← select(h19,h192131)
inc_ty ← ifelse((h19$h192151==1 | h19$h194001 ==1), 1,
ifelse((h19$h192151==2 & h19$h194001 ==2), 2, 0))
inc_oy ← select(h19,h192181)

inc_tabley ← data.frame(inc_ey,inc_my,inc_py,inc_iy,inc_ty,inc_oy)
names(inc_tabley) ← c("inc_ey","inc_my","inc_py","inc_iy","inc_ty","inc_oy")
inc_tabley #소득 유무에 대한 데이터프레임으로 병합
inc_freqy ← data.frame(table(inc_ey) ,table(inc_my) ,table(inc_py), table(inc_iy) ,table(inc_ty) , table(inc_oy))
inc_freqy #각 소득 유무 변수별 빈도수

summary(inc_table$inc) # 가구 총소득 관련 통계치
sd(inc_table$inc, na.rm=TRUE)



<한국노동패널 1~19차년도 조사자료 User's Guide 161p Q14 참고>

스크랩