[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Leonor Saravia" <lmisaravia@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: Tabulate command ordering |

Date |
Wed, 18 Jun 2008 16:13:21 -0400 |

Maarten, thank you very much. The way you have done the tabulation is being very useful. May I bother you again with other question? with the same data, I'd like to know, by range of age, what´s the percentage self -employed males or females. I tryed to do this in the same way you have done the other tabulation (using cond()), but it didn´t work. I'm sure that I´m doing something wrong; so, I tryed in an "ugly" way, this: bysort age: egen self_age_m = count(selfemployed & sex == 1) bysort edad: egen self_age_f = count(selfemployed & sex == 2) bysort edad: egen activity_m = count(activity & sex == 1) bysort edad: egen activity_f = count(activity & sex == 2) gen self_act_age_m = self_age_m / activity_m gen self_act_age_f = self_age_f / activity_f noi tab age self_act_age_m noi tab age self_act_age_f but Stata is not doing what I was expecting. The output (wrong) is this: self_act_age_m age? | 1 | Total -----------+-----------+---------- 1 | 66 | 66 2 | 2,311 | 2,311 3 | 3,761 | 3,761 4 | 3,947 | 3,947 5 | 2,852 | 2,852 6 | 1,924 | 1,924 7 | 1,582 | 1,582 -----------+-----------+---------- Total | 16,443 | 16,443 age | self_act_age_f | Total -----------+-----------+---------- 1 | 66 | 66 2 | 2,311 | 2,311 3 | 3,761 | 3,761 4 | 3,947 | 3,947 5 | 2,852 | 2,852 6 | 1,924 | 1,924 7 | 1,582 | 1,582 -----------+-----------+---------- Total | 16,443 | 16,443 But I´to know the percentage of people satisfying some conditions by age. Thank you again!! Leonor 2008/6/18, Leonor Saravia <lmisaravia@gmail.com>: > 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. > > I'd appreciate very much your advice in this. > > 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/

**Follow-Ups**:**st: Re: Tabulate command ordering***From:*"Leonor Saravia" <lmisaravia@gmail.com>

**Re: st: Re: Tabulate command ordering***From:*Maarten buis <maartenbuis@yahoo.co.uk>

**References**:**st: Tabulate command ordering***From:*"Leonor Saravia" <lmisaravia@gmail.com>

- Prev by Date:
**Re: st: error bars** - Next by Date:
**Re: st: Re: Tabulate command ordering** - Previous by thread:
**Re: st: Tabulate command ordering** - Next by thread:
**Re: st: Re: Tabulate command ordering** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |