Please help identify why this loop wont work on "`x'=="Z591". I get the message "type mismatch" before the command is fully executed.
generate vaed_homeless=0
foreach x of varlist TDIAG1-TDIAG40 {
recode vaed_homeless (0=1) if (`x'=="Z590"|`x'=="Z591")
}
Related Posts with foreach
Heckpoisson error - could not be evaluatedDear Stata Users, I am trying to fit a Poisson model correcting for Sample selection using the heck…
Annual constant increase rate from monthly data*Dear all! I have some monthly inflation CPI data and wanted to create two new time series. First, t…
Matching Panel Data to Diff-in-DiffHowdy, Statalisters, I'm trying to create comparison groups to ultimately move into a diff-in-diff e…
How to write a text.file using loops?Hello everyone! I am trying to solve how to write a text.file using loops. I have hit an obstacle an…
Instrument exogeneity tests.Hello Statalists, I had a question relating both to STATA's instrumental variable post-estimation c…
Subscribe to:
Post Comments (Atom)
0 Response to foreach
Post a Comment