Hi all,
I have imputed my database and now i have a var which included 4 type of z and 4 type of c vars (from reshape before imputation) . I am trying to generate a var by sum up the value of some rows. as below
renam eq5dutility_b (x1)
rename eq5dutility_6m (x2)
rename eq5dutility_12m (x3)
rename eq5dutility_18m (x4)
rename tota_C_without_b (x5)
rename tota_C_without_b_6 (x6)
rename tota_C_without_6_12 (x7)
rename tota_C_without_12_18adj (x8)
reshape long x, i(pid) j(type0)
mi set mlong
mi register imputed x
mi register regular age ethnic recruited geoarea marital employment severity site cid
mi impute chained (regress) x = age ethnic recruited geoarea marital employment severity site cid , add(2) rseed(12345) by(group)
*mi passive: gen total_qaly = QALYb_6m+ QALY6_12m +QALY12_18m_disc
mi register passive qaly_at18
mi passive: by pid: gen qaly_at18 = ((x+x[_n-1])/2*(6/12)) if type0== 2 + ((x+x[_n-1])/2*(6/12)) if type0== 4 + ((x+x[_n_1])/2* (6/12)/ (1+0.035)) if type0 ==6
But the last line doesn't work. could you help me to refine it?
thank you for your suggestions.
Best wishes,
Hiro
I have imputed my database and now i have a var which included 4 type of z and 4 type of c vars (from reshape before imputation) . I am trying to generate a var by sum up the value of some rows. as below
renam eq5dutility_b (x1)
rename eq5dutility_6m (x2)
rename eq5dutility_12m (x3)
rename eq5dutility_18m (x4)
rename tota_C_without_b (x5)
rename tota_C_without_b_6 (x6)
rename tota_C_without_6_12 (x7)
rename tota_C_without_12_18adj (x8)
reshape long x, i(pid) j(type0)
mi set mlong
mi register imputed x
mi register regular age ethnic recruited geoarea marital employment severity site cid
mi impute chained (regress) x = age ethnic recruited geoarea marital employment severity site cid , add(2) rseed(12345) by(group)
*mi passive: gen total_qaly = QALYb_6m+ QALY6_12m +QALY12_18m_disc
mi register passive qaly_at18
mi passive: by pid: gen qaly_at18 = ((x+x[_n-1])/2*(6/12)) if type0== 2 + ((x+x[_n-1])/2*(6/12)) if type0== 4 + ((x+x[_n_1])/2* (6/12)/ (1+0.035)) if type0 ==6
But the last line doesn't work. could you help me to refine it?
thank you for your suggestions.
Best wishes,
Hiro

Comment