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)
I tried
Code:
global mis weekday channel time foreach x of varlist $mis { gen mis=1 if missing($mis) }
Does anyone have an idea on how I can make it work?
I am using STATA 15
Thank you!
0 Response to Loops with generate
Post a Comment