I'd like to calculate the duncan index of segregation, for occupational gender segregation. In addition I'd like to do this by year and country of my observations, which are aggregated (shown in the data example below). I don't think the duncan command works because the data is aggregated, and the dicseg command doesn't work as it doesn't take a by option (needed to group by country and year).

HTML Code:
. dataex country year occupation sex employment if (year==1995 | year==1996) & (occupation=="Managers"|occupation=="Service and sales workers")

----------------------- copy starting from the next line -----------------------
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str14 country int year str104 occupation float sex double employment
"Australia"      1995 "Managers"                  0   565.164
"Australia"      1995 "Managers"                  1   278.202
"Australia"      1995 "Service and sales workers" 0   372.313
"Australia"      1995 "Service and sales workers" 1   863.474
"Australia"      1996 "Managers"                  0    569.11
"Australia"      1996 "Managers"                  1   267.965
"Australia"      1996 "Service and sales workers" 0   371.909
"Australia"      1996 "Service and sales workers" 1   915.227
"Canada"         1995 "Managers"                  0   982.308
"Canada"         1995 "Managers"                  1   512.696
"Canada"         1995 "Service and sales workers" 0   660.893
"Canada"         1995 "Service and sales workers" 1  1260.283
"Canada"         1996 "Managers"                  0   973.775
"Canada"         1996 "Managers"                  1   546.179
"Canada"         1996 "Service and sales workers" 0   688.731
"Canada"         1996 "Service and sales workers" 1  1300.599