File size: 4,793 Bytes
2a8276b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186


clear all
set more off
set maxvar 10000
set mem 500m

*Set path
***

*cd ---- specify path to \data_replication\scf\proc_data\
local ourprocdata  "./our_proc"
local output "./output"

use taxsim2001.dta, clear
*use our processed data
*use "`ourprocdata'/taxsim2001.dta", clear


****************************************************************************************
****************************************************************************************

*Rent
rename X708 rent
rename X709 per_rent
replace rent=rent*12 if per_rent==4 //monthly
replace rent=rent*12*4.34 if per_rent==2 //weekly
replace rent=rent*12*2.17 if per_rent==3 //biweekly
replace rent=rent*4 if per_rent==5 //quarterly
replace rent=rent*2 if per_rent==11 //twice per year
replace rent=rent*6 if per_rent==12 //every two months
replace rent=rent*12*2 if per_rent==31 //twice a month
replace rent=. if per_rent==-1 //none
replace rent=. if per_rent==-7 //other

gen HELS=cond(X1005-X1004>0,0,max(X1005,0)) // some people report more debt than they took initially

*Clean
drop J*
drop X*



********************************************************************************
*Create wealth variables
********************************************************************************
*Value of all houses
replace houses=. if houses<0
replace oresre=. if oresre<0
gen house_val=houses
*Homeownership status
gen ownership=housecl

*liquid assets
gen l_assets=max(othfin,0)+max(checking,0)+max(saving,0)+max(mma,0)+max(cds,0)+max(nmmf,0)+max(savbnd,0)+max(stocks,0)+max(bond,0)+oresre+nnresre

*mortgage debt
gen m_debt=max(NH_MORT,0)-max(HELS,0)
drop m_debt
gen m_debt=max(NH_MORT,0)+max(heloc,0)

*HELOC
gen helocs=max(heloc,0)+max(HELS,0)

*liquid debt
gen l_debt=max(ccbal,0)+max(resdbt,0)

*Wealth (net worth)
gen wealth=house_val+l_assets-l_debt-m_debt
gen hnworth=house_val-m_debt

*Age of head
gen age_head=age

*Generate positive house values
gen h1=house_val if house_val>=0

******
replace inc=inc/equiv
replace h1=h1/equiv
******

******************************
*Drop observation with wealth above 80th percentile
******************************
pctile pct = wealth [w=wgt], nq(100) genp(percent)
gen pk1=pct if percent==80
egen mean_pk1=mean(pk1)
drop if wealth>mean_pk1

*Drop households that are too young or too old
drop if age_head<25
drop if age_head>85

********************************************************************************************************************************************8

gen t_debt_paym=max(tpay,0)/equiv
gen rev_debt_paym=max(revpay,0)/equiv
gen mort_debt_paym=max(mortpay,0)/equiv
gen cons_debt_paym=max(conspay,0)/equiv


********************************************************************************
*Compute correlation between mtg payments and all other payments
******************************
gen non_mort=cons_debt_paym+rev_debt_paym
correlate non_mort mort_debt_paym [weight=wgt]
********************************************************************************

********************************************************************************

*10 pct PTI ratio, borrowers
preserve
gen ratio1=mort_debt_paym*12/inc
collapse (p10) ratio1 [weight=wgt] if mort_debt_paym>0
gen res=ratio1*0.6
replace res=round(res, 0.01)
gen title="10 pct PTI ratio, borrowers"
save mpti1.dta, replace
restore

*25 pct PTI ratio, borrowers
preserve
gen ratio1=mort_debt_paym*12/inc
collapse (p25) ratio1 [weight=wgt] if mort_debt_paym>0
gen res=round(ratio1, 0.01)*0.6
replace res=round(res, 0.01)
gen title="25 pct PTI ratio, borrowers"
save mpti2.dta, replace
restore

*Median PTI ratio, borrowers
preserve
gen ratio1=mort_debt_paym*12/inc
collapse (median) ratio1 [weight=wgt] if mort_debt_paym>0
gen res=round(ratio1, 0.01)*0.6
replace res=round(res, 0.01)
gen title="Median PTI ratio, borrowers"
save mpti3.dta, replace
restore

*75 pct PTI ratio, borrowers
preserve
gen ratio1=mort_debt_paym*12/inc
collapse (p75) ratio1 [weight=wgt] if mort_debt_paym>0
gen res=round(ratio1, 0.01)*0.6
replace res=round(res, 0.01)
gen title="75 pct PTI ratio, borrowers"
save mpti4.dta, replace
restore

*90 pct PTI ratio, borrowers
preserve
gen ratio1=mort_debt_paym*12/inc
collapse (p90) ratio1 [weight=wgt] if mort_debt_paym>0
gen res=round(ratio1, 0.01)*0.6
replace res=round(res, 0.01)
gen title="90 pct PTI ratio, borrowers"
save mpti5.dta, replace
restore


forval x=1(1)5{
use mpti`x'.dta, clear
keep res title
duplicates drop
save mpti`x'.dta, replace
}

use mpti1.dta, clear
forval x=2(1)5{
append using mpti`x'.dta
}

order title res

***
cd ..


outsheet using "`output'/tab3_panelF.csv", replace c