I'm stumped on how to create a varlist vt that contains the temporary variables
Code:
`_ty1' `_ty2' `_ty3'
that are defined in the following code.

The foreach loop I use at the bottom accomplishes this but I'm assuming there must be a one-line local definition using a * wildcard. However I can't seem to get the single/double quote nesting correct to accomplish this. (The real application has lots of temporary variables, thus the desire to use a wildcard.)

Can anyone advise? I'm happy to use the foreach loop but this seems unnecessarily clunky. Also in the real example the variables aren't indexed by a simple `j' thus the desire to use y* as the varlist in my current foreach loop.

Thanks in advance.

Code:
cap preserve
cap drop _all

set obs 100

forval j=1/3 {
 tempvar _ty`j'
 gen y`j'=10*uniform()
 gen `_ty`j''=floor(y`j')
}

local vt=" "
foreach y of varlist y* {
 local vt="`vt'"+"`_t`y'' "
}
sum `vt'

cap restore