Code:
local alpha 1 2 3 4 5 di "`alpha'" local not 1 local alpha: list alpha- not di "`alpha'"
`"10151_1A"' `"10151_1B"' `"10641_1"' (after running the levelsof command)
10151_1A10151_1B10641_1 (when displaying levels_nonmissing the first time)
`10151_1A"' `"10151_1B"' `"10641_1"'" (when displaying it the second time)
It looks like the quote at the beginning of the local was moved to the end. My code is below:
Code:
pause on
levelsof id, local(levels)
levelsof id, local(levels_nonmissing)
di `levels_nonmissing'
foreach unt of local levels {
local not "`unt'"
local levels_nonmissing: list levels_nonmissing - not
di "`levels_nonmissing'"
pause
}https://www.statalist.org/forums/for...a-new-variable
to iterate through subsets of my data, run regressions, store their coefficients, and label my coefficient columns. Some of my regressions don't work, so I'm using capture and a conditional statement to try to remove those names from the local macro so that I can name the non-missing regressions correctly (skipping the missing id names).
Thanks!
0 Response to Dropping elements from local created with levelsof
Post a Comment