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
Pedroni's Panel Cointegration Tests and Panel Dynamic OLS estimationDear all, I was trying to conduct the Pedroni's Panel Cointegration Tests and Panel Dynamic OLS est…
Renaming Windows directory using Stata syntax?Dear Statalist Is there a way to rename directories on my Windows PC from within Stata? I found how…
Heteroscedasticity and auto correlation in dummy variablesi am calculating CSSDt and Rmt from a cross section data .I calculated the Q1 and Q3 from Rmt to sho…
Blanks in polychoric matrixHi, does any one know the reason why the polychoric matrix often include blank values? Why is the th…
Issue with predictnlDear All, I am going through the paper by Karaka-Mandic, Norton and Down (2012) "Interaction terms …
Subscribe to:
Post Comments (Atom)
0 Response to Forvalues loop for the repeated variable
Post a Comment