# st: Tabulate command ordering

 From "Leonor Saravia" To statalist@hsphsun2.harvard.edu Subject st: Tabulate command ordering Date Wed, 18 Jun 2008 13:22:00 -0400

```Dear Statalisters,

First IŽd like to thank Andrea Bennet and Austin Nichols, for the help
in merging the different datasets that I'm already using. :)

I'm working with a database that has information for working people,
male and female, in different ranges of age and I'd like Stata to
count how many male (female) persons are in each interval of age and
satisfy the condition of being a self-employed person. Until now, I' m
doing this:

bysort age: egen indep_m = sum(selfemploy == 1 & sex == 1)
tab inxed_m

bysort age: egen indep_f = sum(selfemploy == 1 & sex == 2)
tab inxed_f

And the Stata output for this is:

inxed_m |      Freq.     Percent        Cum.
------------+-----------------------------------
2 |         66        0.40        0.40
70 |      1,582        9.62       10.02
144 |      2,311       14.05       24.08
231 |      1,924       11.70       35.78
373 |      3,761       22.87       58.65
427 |      2,852       17.34       76.00
530 |      3,947       24.00      100.00
------------+-----------------------------------
Total |     16,443      100.00

inxed_f |      Freq.     Percent        Cum.
------------+-----------------------------------
0 |         66        0.40        0.40
26 |      1,582        9.62       10.02
65 |      2,311       14.05       24.08
68 |      1,924       11.70       35.78
164 |      2,852       17.34       53.12
171 |      3,761       22.87       76.00
259 |      3,947       24.00      100.00
------------+-----------------------------------

My problem is that when I tabulate the result variables (" indep_m"
and "indep_f ") Stata brings the output of the number of persons in
each age range in an ascending order, but I'd like to have the
information ordered by the range of age (not by the number of persons
satisfying the conditions), to know how many persons are working as
independent in each range of age.

Thanks!

Leonor

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```