I have a dataset which is broken down by year, age, education level, and region. I am trying to generate a variable for the weighted average education level in a given year in each region by age. I have tried to do this with the egen command and the wtmean function. However, when I attempt this I get an an error message of "varlist not allowed". My code is below.
egen wtavg = wtmean(schooling) weight(qty), by (year age region)
egen wtavg = wtmean(schooling) weight(qty), by (year age region)
Comment