Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Find the percentage of the prevalence for gender

    Thank you in advance for you answers.
    I try to find the mean and percentage for the gender separate in my dataset. For some reason I only get the n and not a mean or %. This is what I did and have. The code to get this must be simple, but this rookie is stuck again.

    . tab b02

    Sex | Freq. Percent Cum.
    ------------+-----------------------------------
    Male | 288 50.00 50.00
    Female | 288 50.00 100.00
    ------------+-----------------------------------
    Total | 576 100.00

    tab b08 b02

    Occupational | Sex
    status | Male | Total
    -----------------+-----------+----------
    Unemployed | 34 | 70
    Student | 242 | 485
    Work | 10 | 17
    Work and Student | 2 | 4
    -----------------+-----------+----------
    Total | 288 | 576


    Occupational | Sex
    status | Female | Total
    -----------------+-----------+----------
    Unemployed | 36 | 70
    Student | 243 | 485
    Work | 7 | 17
    Work and Student | 2 | 4
    -----------------+-----------+----------
    Total | 288 | 576




  • #2
    Anna:
    you may want to consider something along the following lines:
    Code:
    . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
    (1978 automobile data)
    
    
    . tabstat price foreign, stat(N mean)
    
       Stats |     price   foreign
    ---------+--------------------
           N |        74        74
        Mean |  6165.257  .2972973
    ------------------------------
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi thanks,
      Only it is still not separated by gender. I need to separate by gender for 25 variables which are a mix of binary, ordinal and continuous.
      tabstat b05 b02, stat(N mean). This is what I got when I used what you suggested.

      Stats | b05 b02
      ---------+--------------------
      N | 576 576
      Mean | 14.52431 .5
      ------------------------------

      Comment


      • #4
        Anna:
        do you mean something like what follows?
        Code:
        . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
        (1978 automobile data)
        
        . tabstat price mpg rep78, stat(N mean sd p25 p50 p75 min max) by(foreign)
        
        Summary statistics: N, Mean, SD, p25, p50, p75, Min, Max
        Group variable: foreign (Car origin)
        
         foreign |     price       mpg     rep78
        ---------+------------------------------
        Domestic |        52        52        48
                 |  6072.423  19.82692  3.020833
                 |  3097.104  4.743297   .837666
                 |      4184      16.5         3
                 |    4782.5        19         3
                 |      6234        22         3
                 |      3291        12         1
                 |     15906        34         5
        ---------+------------------------------
         Foreign |        22        22        21
                 |  6384.682  24.77273  4.285714
                 |  2621.915  6.611187  .7171372
                 |      4499        21         4
                 |      5759      24.5         4
                 |      7140        28         5
                 |      3748        14         3
                 |     12990        41         5
        ---------+------------------------------
           Total |        74        74        69
                 |  6165.257   21.2973  3.405797
                 |  2949.496  5.785503  .9899323
                 |      4195        18         3
                 |    5006.5        20         3
                 |      6342        25         4
                 |      3291        12         1
                 |     15906        41         5
        ----------------------------------------
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          HI Carlo,
          I actually have one variable (b02) that is sex Male/ female. I also have a variable that contains two age categories (need the mean for each category) and one that is simply one continues age, and many other variables that are ordinal. I have to look at the separate outcomes for male and female for all of my variables. Most of them just I only need the prevalence and percentage, but when I use the command (tab b08 b02) I only get prevalence (n) and not(%). It must be something simple to get this done, but I haven't figured it out yet.

          Comment


          • #6
            Update: I did figured it out.
            Thanks for the responses.

            Comment

            Working...
            X