Hi,
I have a question regarding the loop!
I generated a variable and replaced it like this;
gen tele_among_full=.
replace tele_among_full=2 if full==1 & E6==6
replace tele_among_full=1 if full==1 & (E6==3|E6==4|E6==5)
replace tele_among_full=0 if full==1 & (E6==1 |E6==2)
but my supervisor said full==1 is repeated so there is an easier way to do and showed me this;
forvalues full==1{
replace tele_among_full=2 if E6==6
replace tele_among_full=1 if E6==3|E6==4|E6==5
replace tele_among_full=0 if E6==1 |E6==2
}
but it is not working. I don't see how full==1 can be fit in 'if'.
Is it a correct code?
Thank you!
Related Posts with Forvalues loop for the repeated variable
repeated measures latent class analysis (RMLCA) ID TIME_POINT A B C 1 1 5 10 10 1 2 25 25 25 1 3 50 50 25 2 1 50 25 25 2 2 25 75 75 2…
Dealing with gaps in data.Hi, I'm having trouble getting my data in the right format. I'm working with weakly data values but …
create a weight on dependent var and run as regressionDear all, I have searched in the forum on how to create a weight for a variable but I could not pre…
Big Five - combined mean of six itemsHi, I have six items, which is rated on a likert-scale (1-5). I would like the combined mean of the…
A Stochastic Frontier analysis under self selectionDear StataList, I am trying to estimate the effect of Stochastic Frontier analysis under self-selec…
Subscribe to:
Post Comments (Atom)
0 Response to Forvalues loop for the repeated variable
Post a Comment