stata - Checking If against multiple values -
i'm using ssc install vallist
generate list of applicable countries outputs macro like:
r(list) : "32 36 348 392 410 76 112 152 156 203" optionally, can returned separated commas instead of spaces if it's helpful)
i want tab
variable if has country anywhere in list.
any thoughts on how this. i'd utilize inlist, i'd have pass each country in manually this
typing hand works fine tab health if inlist(country, 32, 36, 348,... 203) i'd tab health if inlist(country, r(list))
perhaps, there way can loop through each element in list , apply filter if statement?
you need utilize quotes evaluate local , need utilize commas separate values. here's illustration using auto data.
sysuse auto vallist rep78, sep(,) tab foreign if inlist(rep78, `r(list)')
stata
No comments:
Post a Comment