I'm trying to create a loop that automatically replaces all observations with a "." with exception to the observations associated with a specific Location.
I need some help understanding the anatomy of the syntax because the one I'm trying is not working.
I'm trying:
I'm copying this command from a previous destring loop that I was briefly taught about, so there could be some naiive misunderstanding that's making it non-functional.
I understand that
refers to literally "for each"
However, the letter v, is confusing. Does stata understand "v" to mean "variable"?
Also, for
, my understanding is that the compound quotations are for strings. Are they necessary here?
What would the correct code be?
Thanks
I need some help understanding the anatomy of the syntax because the one I'm trying is not working.
I'm trying:
HTML Code:
foreach v in `r(varlist)' {replace `v' = . if Location !== 19}
I understand that
HTML Code:
foreach
However, the letter v, is confusing. Does stata understand "v" to mean "variable"?
Also, for
HTML Code:
`r(varlist)'
What would the correct code be?
Thanks
Comment