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
Number of constraints in constrained linear regressionGreetings, I am experimenting with constrained linear regression (cnsreg) using a simple linear reg…
Standardized mortality ratios following multiple imputationI'm honestly a bit unsure of the proper etiquite for estimating SMRs in an (multiple imputation) MI …
Mean of observations contained in other variableDear Forum, I have a variable, named "cbo02". I want to calculate the mean of the observations of th…
Plotting Y1 and Y2 variable on a Time Series Line Plot Code: * Example generated by -dataex-. To install: ssc install dataex clear input double(prod op) …
How to add "tailor made" error bars to a line graph.Dear beloved all, Recently I am working on how to draw a line graph like this: Array However, my …
Subscribe to:
Post Comments (Atom)
0 Response to Loop foreach help
Post a Comment