Good evening to everyone,
I need to basically append an empty list: after a loop in which I create some scalars, at the end of each scalar creation I would love to plug it into a cell. I think it should be possible with some combinations of
and
, but I can't figure out how to solve the issue... Here is the code:
I would simply love to plug the values of DIFF_`i' into a column vector.
I need to basically append an empty list: after a loop in which I create some scalars, at the end of each scalar creation I would love to plug it into a cell. I think it should be possible with some combinations of
Code:
generate
Code:
replace
Code:
forvalues i = 2(1)48{ count if Z_`i' == 1 & Prom__20161 >= 4 & Prom__20161 !=. scalar NZ_`i'_1 = r(N) count if Z_`i' == 1 & Prom__20161 !=. scalar NZ_`i'_1_tot = r(N) scalar P_Y1_4_Z_`i'_1 = NZ_`i'_1 / NZ_`i'_1_tot count if Z_`i' == 0 & Prom__20161 >= 4 & Prom__20161 !=. scalar NZ_`i'_0 = r(N) count if Z_`i' == 0 & Prom__20161 !=. scalar NZ_`i'_0_tot = r(N) scalar P_Y1_4_Z_`i'_0 = NZ_`i'_0 / NZ_`i'_0_tot scalar DIFF_`i' = P_Y1_4_Z_`i'_1 - P_Y1_4_Z_`i'_0 di DIFF_`i' }
Comment