hi all, I'm trying to generate a new set of variables and struggling with the naming --

I have a variable of "state" that has a number assigned to each state, and a variable for 2016 presidential election results. I want to create a new set of variables, one for each state, of the presidential vote share.

forvalues j = 1/50 {
generate pres_`j'=.
replace pres_`j'=pres2016 if state==`j'
}

This works, but I want the output to be the state names like pres_alabama, pres_alaska, pres_arizona ...

Any idea how to do this? Should I be using the foreach command instead of forvalues? All help is greatly appreciated!