Dear all,

I would like to know how to rank means from highest to lowest after the following command:
Code:
bysort occupation: sum im
where im is a immigrant status indicator. The command gives me the proportion of immigrants in a given occupation.
I would like to rank these different proportions from highest to lowest.

Moreover, I would like to know the overall cumulative percentage of immigrants for a given occupation given I ranked the proportions from top to bottom. An example might help.
occupation, number of immigrants, number of natives, proportion of immigrants, cumulative percentage of immigrants (defined as number of immigrants in a given occupation divided by total number of immigrants in all occupations (say 1000):
teacher, 50, 50, 0.5, 0.05.

I do not think I can get one single command that does it all, but any help would be greatly appreciated.

Best wishes,

Nico