Hi,

I am trying to recreate the table below:

Array

I have created the mean education for period by sex using the command:

"bysort period1 region : egen bam = mean f_yschool"

where period1 is the periods I am using in my study. What I essentially want to run is "bysort year region: gen relative_mschool= (mean_regionalmaleschooling)/(mean_regionalmaleschooling if r_code=2"

as r_code==2 is the region with the highest years of schooling. How do I divide the mean year of schooling per region per period by another value (region mean) from the same period in the variable?

It's a similar problem to this: https://www.stata.com/statalist/arch.../msg00492.html


Many thanks in advance.