Hi all,

I am trying to generate a dummy variable identifying missings values for a long list of variables.
So started by generating

Code:
 ​​​​​gen misweekday=1 if missing(weekday)
replace misweekday=0 if !mis(weekday)
And this does work. But I was trying to do some kind of loop with it, so I wouldn't have to edit the code for 100 or so variables.


I tried
Code:
global mis weekday channel time 

foreach x of varlist $mis {
gen mis=1 if missing($mis)
}
But it doesn't work at all.
Does anyone have an idea on how I can make it work?
I am using STATA 15
Thank you!