Hi, I need some help
I'm working with migration data and I'd like to replace the values of the variable p10 by adding "01" to the observation by using a loop.
This is what I want to do:
replace p10 = 101 if p10==1
replace p10 = 201 if p10==2
replace p10 = 301 if p10==3
replace p10 = 401 if p10==4
replace p10 = 501 if p10==5
replace p10 = 601 if p10==6
replace p10 = 701 if p10==7
replace p10 = 801 if p10==8
replace p10 = 901 if p10==9
replace p10 = 1001 if p10==10
This is the loop that is not working
forvalues i = 1/10 {
replace p10 = `i'01 if p10 = `i'
}
Related Posts with Replacing observations with conditions using loop
The independence of irrelevant alternatives assumpition test of multinominal logit has an errorDear statalist users: The independence of irrelevant alternatives assumpition test using "mlogtest, …
How can I calculate how many of my panel persons switched their dummy status between observation periods?Dear all, I have a unbalanced Panel data set with approx. 10000 panel persons and 3 observation per…
Advice on which logit model to useDear All I have conducted a choice experiment on eco - labels and now need to estimate a logit mode…
Unable to start SEM Builder - Stata/MP 15.1Dear all, in my Stata/MP 15.1 version I am unable to start the SEM Builder. After clicking on "SEM …
Confidence Intervals upper bound above 1 (100%) for survey data prevalenceI have a problem with generated confidence intervals for prevalence using survey data. We are invest…
Subscribe to:
Post Comments (Atom)
0 Response to Replacing observations with conditions using loop
Post a Comment