Dear team of IPUMS,

dear members of the forum,

In order to create a longitudinal weight for linking adjacent months, I need a final weight for imputed data (non-responses or refusals).

As a first draft, I am using ipfraking, taking the population totals weighted by WTFINL as a control and raking a monthly data set of an unweighted sample of imputed and original data. I am using an altered .do-file from the IPUMS for the creation of a longitudinal weight link

The months I’ve done this for have a difference of `total(WTFINL, CPS final weight)`

- `total(FINAL_RAKED, recreated final weight)`

of zero, which gives me some confidence.

However, I would appreciate your thoughts on this approach.

Below you find my Stata code.

Kind regards,

Hannes

```
*#delimit
version 15
clear
set more off
set matsize 2000
cd "Z:\Daten\CPS\imputation_final_weights\"
local logdate = string( d(`c(current_date)'), "%dN.D.Y" )
log using logs\generate_weights_for_linked_cps_data_`logdate'.log, t replace
local startyr = 1996
local startmo = 1
if "`0'" != "" {
if "`2'" != "" {
local startyr = `1'
local startmo = `2'
}
else {
di as error "No month specified"
}
}
di as text `"Starting from `startyr'-`startmo'."'
forval yr = `startyr'/2021 {
forval mo = `startmo'/3 {
use "Z:\Daten\CPS\imputation_final_weights\monthly\ipums_cps_`yr'_`mo'.dta", clear
svyset [pw=wtfinl]
disp "...combining categories of age, sex, race, hispan, state from which we will generate population totals"
include "G:\final weight recalc\create_grouped_vars.doi"
foreach x in has_group ras_group gas_group {
disp "...summing counts for raking groups based on individuals"
svy: total _one, over(`x', nolabel)
matrix rake_`x' = e(b)
matrix rowname rake_`x' = `x'
matrix list rake_`x'
}
disp "...generate overall population count."
svyset [pw=_one]
*svy: total _one if imputed_mish != 1
svy: total _one
gen double pre_ipfraking_total=`e(N_pop)'
disp "...perform raking using groups defined in create_grouped_vars.doi"
local threeway rake_ras_group rake_has_group rake_gas_group
ipfraking [pw=_one], ctotal(`threeway') gen(rakeweight_threeway) nograph
disp "...generate original population count with final weights of CPS."
svyset [pw=rakeweight_threeway]
svy: total _one
gen double post_ipfraking_total=`e(N_pop)'
/*check pre-raked weight sum and post-raked weight sum*/
format pre_ipfraking_total %15.0f
format post_ipfraking_total %15.0f
gen final_raked=rakeweight_threeway
gen diff=round(final_raked)-round(wtfinl)
tab diff
disp "...saving the raked file"
rename mish mis_`yr'_`mo'
rename wtfinl wtfinl_`yr'_`mo'
save generated/raked_`yr'_`mo'.dta, replace
} //end mo
} //end yr
```