I am stuck on how to program a list that I want to run at the same time (ie not a loop).
Currently I have a code as such (simplified):
I do not want to keep typing the variable and the number each time and would like automatize that aspect.
What I would like to do is take each variable from local vars and calculate something like this:
This obviously does not work, but I don't know enough about stata's programming language to know how to calculate the variables in order, but also simultaneously.
Thank you for your help.
Currently I have a code as such (simplified):
reg gini gender age2 age3 if T==1 [aweight=w]
scalar define gamma_hat = _b[_cons] + _b[gender]*mean_t1[1,1] + _b[age2]*mean_t1[1,2] + _b[age3]*mean_t1[1,3]
scalar define gamma_hat = _b[_cons] + _b[gender]*mean_t1[1,1] + _b[age2]*mean_t1[1,2] + _b[age3]*mean_t1[1,3]
What I would like to do is take each variable from local vars and calculate something like this:
local vars gender age2-age3
local i = 1
reg gini `vars' if T==1 [aweight=w]
scalar define q_gamma1_1_hat = _b[_cons] + _b[var1]*mean_t1[1,i] + _b[var2]*mean_t1[1,i+1] + _b[var3]*mean_t1[1,i+2]
local i = 1
reg gini `vars' if T==1 [aweight=w]
scalar define q_gamma1_1_hat = _b[_cons] + _b[var1]*mean_t1[1,i] + _b[var2]*mean_t1[1,i+1] + _b[var3]*mean_t1[1,i+2]
Thank you for your help.
Comment