I am about to create several temporary variables following the pattern tmp_*
, and will drop
(delete) them afterwards. I thought I would be clever and do...
ds tmp_*
assert ": word 1 of `r(varlist)'" == ""
** then I create and do stuff with tmp_bah and tmp_blah
drop tmp_*
That is, I wanted to perform a preliminary check to ensure that my final step does no damage to preexisting variables like tmp_thing_i_forgot_about
.
Unsurprisingly, Stata did not oblige. The designers think my ds tmp_*
is an error because it returns an empty result. I see that ds
has several options, but none of them make it act like a normal search on the list of variable names (which would not whine upon a failed search).
I'm hoping someone can help me find the idiomatic way of approaching this problem.