Minor but annoying problem with locals. I have a long variable list that I would like to add to a file with the following code. I keep on getting errors for invalid syntax and too few variables specified. I have not been able to find a fix to the code. Any suggestions
local vars "site_visits_with_case_worker Indoor_Bathroom Porta_Potty washing_Station ADA_Compliant_Shower"
local num: word count `vars'
foreach i in 1/`num' {
local temp `: word `i' of `vars''
di `temp'
gen `temp' = .
}
Related Posts with Problem with locals
Multiple commands in one line stored in a localI have a problem executing a local with multiple Stata commands separated by ";". If I use this cod…
Coefplot graph error despite running the regressionI'm supposed to get a coefplot graph using the following data and code but unfortunately I'm coming …
Is it possible to combine binscatter and vioplot?Vioplot works on categorial x axis. binscatter makes continuous, discrete. I am looking to have a hi…
anycountDear all I would like to count the number of values across 5 numeric variables. I tried using "anyc…
Problems with regressions (regress.ado r(199)Hi, I have run into some problems with making regressions in Stata (version 16). I have been using …
Subscribe to:
Post Comments (Atom)
0 Response to Problem with locals
Post a Comment