st: matching a long list of codes

The better way to handle this sort of thing is to put the codes you list in
a dataset by themselves , and then merge that dataset onto the one from
which you want to select the codes. Then where the merge finds the code in
both the main dataset and the code dataset (_merge==3) your dani can be set
to one (e.g.
gen dani = (_merge==3) will do it). There was a recent thread on this
method, pointing to a FAQ on the Stata web site re group characteristics.