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
Generating new variable for several observationsHi Everyone, I have this example below, where I have used "exapnd 12" to have each city 12 times. T…
Identify case in GraphEditor ??I'm looking at the trends of my data and want to identify specific cases from the graph that are out…
consecutive observationHi, I have read this https://www.stata.com/support/faqs/d...-observations/, and understand how to k…
How to compute std error for eyex marginReally, really appreciate the article "When I use the eyex option of margins, what is it actually co…
Graphs Unconditional quantile regressionHello, I would like to know if you could help me with the following: I´m running the following unco…
Subscribe to:
Post Comments (Atom)
0 Response to Loop foreach help
Post a Comment