Hi,

So I created a dummy variable by the following code:

gen YearGroup = 0
replace YearGroup = 1 if year>=2011
label define YearGroup_label 0 "Max MTR 2003-2010" 1 "Max MTR 2011-2018"
label values YearGroup YearGroup_label

Now I am trying to take the mean of another variable (which is MIT) by Region_Name and YearGroup but I get the error varlist not allowed

MIT

30
60.06
20
40
28

I used the following command:

egen mean_MIT_yearGroup = mean(MIT) by (Region_Name YearGroup)

but it gives me error. Can someone please help? Thank you.