Hi everyone. I am trying to fill in missing values in one variable by completing it with values from another one. I am working with observations with often lack the end date, in which case I want to make the end date be the same as the start date. I use this code:
foreach x of end_year {
replace end_year = start_year `x' if missing(end_year`x')
}
and I am getting an error message saying "invalid 'end_year'). Nevertheless, I have triple checked for extra spaces, but this does not seem to be the issue. What could it be? Thank you.
Related Posts with Loop foreach help
Stata 17 ptrendsHi, I'm a student working on a diff in diff using Stata 17's new didregress. I used the postestimati…
Mean-adjusted change research designDear all, For my Master Thesis I am examining the change in institutional holdings after receiving …
replicating an instrumented model in eregress and ivreg2 (or ivregress)Hi Stata people, I would like to replicate a model I am using in eregress (Stata 15 and up) and ivr…
Replace values in each rowHi, In the following dataset: Code: * Example generated by -dataex-. To install: ssc install data…
replicating an instrumented model in eregress and ivreg2 (or ivregress)Hi Stata people, I would like to replicate a model I am using in eregress (Stata 15 and up) with iv…
Subscribe to:
Post Comments (Atom)
0 Response to Loop foreach help
Post a Comment