Combining lists in STATA
Just a quick one: today I learned that you can easily add or substract lists from each other in STATA. Say you want a list of all numeric variables, apart from a couple. This is how you would do it:
*First list, all numeric varsGet Lana Bojanić’s stories in your inbox
Join Medium for free to get updates from this writer.
ds, not(type string)
local not_string `r(varlist)'
di "`not_string'"
*Second list, the numeric variables we want to exclude
local num_exc idnum year age
di "`num_exc'"
*Final list, simply substract!
local final_list: list not_string - num_exc
di "`final_list'"
Simple! While working on this I listened to:







