Dear Statalist members,

i need help with a stata code. I have data on cities within the Uk

I wan to calculate the proportion of employment in each city at the i digit industry level each year . I have a variable called employment at the city level and my industry variable(sic_1) is at the 1 digit level (ranges from 1 to 9)



Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int year byte sic_1 double employment str6 city
1997 1  54.08769668519048 "London"
1997 1  73.07463417915024 "Essex"
1997 2  59.05968811831689 "London"
1997 2  61.44326888837763 "Essex"
1997 3  40.98425906135514 "London"
1997 3  62.02598668195702 "Essex"
1997 4   65.1810169258588 "London"
1997 4   75.1066153677049 "Essex"
1997 5  54.12021605954607 "London"
1997 5  53.37966399060853 "Essex"
1997 6  49.52648645433413 "London"
1997 6 52.000408742377566 "Essex"
1997 7  51.60031037604652 "London"
1997 7   52.8027065170633 "Essex"
1997 8  50.37985992614201 "London"
1997 8  51.27768609766951 "Essex"
1997 9  52.20491985980248 "London"
1997 9  50.60917635878345 "Essex"
1998 1   48.6436566075447 "London"
1998 1 48.794584735114896 "Essex"
1998 2 49.801065829718496 "London"
1998 2  52.06410881189149 "Essex"
1998 3  50.99885022670681 "London"
1998 3  52.44109572491248 "Essex"
1998 4 55.552461927164224 "London"
1998 4 56.645853956985015 "Essex"
1998 5  55.14270772565902 "London"
1998 5  54.66427347292895 "Essex"
1998 6 54.040502383238376 "London"
1998 6 52.111713453797314 "Essex"
1998 7  53.09959389875997 "London"
1998 7  54.75493120768624 "Essex"
1998 8 56.730362634566546 "London"
1998 8 58.349022882006906 "Essex"
1998 9  59.78753983409949 "London"
1998 9  61.05003414993989 "Essex"
2001 1  60.00401825408841 "London"
2001 1 58.431435320284805 "Essex"
2001 2  57.28097641466853 "London"
2001 2 57.931585650647364 "Essex"
2001 3  59.38237975034002 "London"
2001 3 56.353335395044134 "Essex"
2001 4  57.12971932143041 "London"
2001 4  57.29789763097837 "Essex"
2001 5 59.763054102687654 "London"
2001 5 62.087372466229354 "Essex"
2001 6 60.917129977206784 "London"
2001 6  61.15803334776842 "Essex"
2001 7   63.6887061635924 "London"
2001 7  68.35047982900696 "Essex"
2001 8  73.73339656952838 "London"
2001 8  80.14376844232532 "Essex"
2001 9  84.99187391851496 "London"
2001 9  81.86854888686999 "Essex"
end
I would like to find the share of each industry(sic) in total employment in a particular year. My actual data has 103 cities.


Many thanks.

Bridget