I am using stata 14.2
I would like to compute percentages instead of sum so that the total for each country sum to 100%. I need help on how to do this.
I used "collapse" and "egen" but could not get what I am looking for,

I used the following command to get the sum of values

bys country: table sector, c(sum us), if status!=3, row col
-> country = Afghanistan
Sector sum(us)
Agriculture 11.26
Education 0.20
Energy 17.73
Finance 13.37
Health 0.67
Public Administration 0.17
Transportation 114.06
Total 157.45
-> country = Albania
Sector sum(us)
Agriculture 40.16
Education 1.00
Finance 28.03
Health 16.58
Industry and Mining 5.26
Transportation 480.15
Water, Sanitation & Urban Services 27.45
Real Estate 4.40
Total 603.03