Announcement

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

  • Calculate percentages by sex (survey)

    Hello,

    I have the dataset below where i_sex is female or male and i_scghqd is a question about whether people fell capable about taking decisions.
    I used the command svy linearized: tabulate i_sex i_scghqd to calculate the percentage of men and women that answer to the question. However, the percentages that I obtained are the ones related to the total number of individuals in the sample. I would like to know the comand to calculate the percentage of men tand women hat answer to the question in comparation to the total number of men and women (respectively) in the sample.
    Can you help me with this? Thank you in advance.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long(pidp pid) byte(i_sex i_scghqd)
       76165  10689869 2 2
      732365  15752658 1 4
     1587125  17870879 2 2
     4849085 176725733 1 2
    68002725  10023526 2 2
    68008847        -8 2 2
    68010887        -8 2 2
    68029931        -8 1 1
    68031967        -8 2 2
    68035365  10403086 1 2
    68035367        -8 1 2
    68041487        -8 2 2
    68041491        -8 1 1
    68045567        -8 2 2
    68051007        -8 1 2
    68051011        -8 2 2
    68058487        -8 1 2
    68058491        -8 2 2
    68060531        -8 2 2
    68060533 160066204 2 3
    68060537 160066239 1 2
    68063247        -8 2 2
    68063927        -8 2 2
    68063931        -8 1 2
    68064605  10653872 1 2
    68064609  10653902 2 2
    68068007        -8 1 2
    68068082        -8 1 2
    68097245  10913629 2 1
    68097927        -8 2 2
    68120367        -8 2 2
    68120375        -8 2 2
    68125127        -8 2 2
    68125131        -8 1 2
    68125135        -8 2 2
    68133285  11218193 2 2
    68133289  11218282 2 3
    68136009  11234989 2 2
    68137365  11240547 2 2
    68138045  11242787 1 2
    68138049  11242817 2 2
    68138051        -8 2 2
    68144847        -8 1 2
    68144851        -8 2 2
    68148247        -8 1 2
    68150971        -8 2 2
    68150975        -8 1 2
    68155047        -8 2 2
    68155051        -8 1 2
    68157771        -8 2 2
    68159131        -8 2 2
    68160485  11418567 2 3
    68160489  11418591 1 2
    68173407        -8 2 2
    68180887        -8 2 3
    68184971        -8 2 2
    68185647        -8 2 2
    68187687        -8 1 2
    68187691        -8 2 2
    68191771        -8 2 2
    68193127        -8 2 2
    68195167        -8 1 2
    68195171        -8 2 2
    68195851        -8 2 2
    68197887        -8 2 2
    68197899        -8 2 2
    68197903        -8 1 1
    68199247        -8 1 2
    68207407        -8 2 2
    68207411        -8 1 2
    68211487        -8 1 2
    68214207        -8 1 2
    68216247        -8 2 2
    68218287        -8 1 2
    68231223        -8 2 2
    68238011        -8 2 1
    68262487        -8 1 2
    68266567        -8 2 2
    68278127        -8 2 2
    68288327        -8 2 2
    68288331        -8 1 2
    68291731        -8 2 2
    68293087        -8 2 2
    68293091        -8 1 2
    68293095        -8 1 1
    68293099        -8 1 2
    68293168        -8 1 2
    68294447        -8 1 2
    68294451        -8 2 2
    68297845  12521361 1 2
    68297849  12521396 2 2
    68297857  12521469 2 1
    68299207        -8 2 2
    68302611        -8 2 2
    68309407        -8 2 2
    68321647        -8 1 2
    68321651        -8 2 2
    68322327        -8 2 2
    68322331        -8 1 2
    68329807        -8 2 2
    end
    label values pid pid
    label def pid -8 "inapplicable", modify
    label values i_sex i_sex
    label def i_sex 1 "male", modify
    label def i_sex 2 "female", modify
    label values i_scghqd i_scghqd
    label def i_scghqd 1 "More so than usual", modify
    label def i_scghqd 2 "Same as usual", modify
    label def i_scghqd 3 "Less so than usual", modify
    label def i_scghqd 4 "Much less capable", modify
    Best regards

  • #2
    Dear Ana,

    One alternative to compare the response for each option with the totals of males and females is :
    Code:
    tabulate i_scghqd i_sex , col nofreq
    Which should result in:
    Code:
                       |         i_sex
              i_scghqd |      male     female |     Total
    -------------------+----------------------+----------
    More so than usual |     10.53       4.84 |      7.00 
         Same as usual |     86.84      88.71 |     88.00 
    Less so than usual |      0.00       6.45 |      4.00 
     Much less capable |      2.63       0.00 |      1.00 
    -------------------+----------------------+----------
                 Total |    100.00     100.00 |    100.00
    Likewise, to compare the response between males and females with the totals ofeach option:
    Code:
    tabulate i_scghqd i_sex , row nofreq
    Which should result in:
    Code:
                       |         i_sex
              i_scghqd |      male     female |     Total
    -------------------+----------------------+----------
    More so than usual |     57.14      42.86 |    100.00 
         Same as usual |     37.50      62.50 |    100.00 
    Less so than usual |      0.00     100.00 |    100.00 
     Much less capable |    100.00       0.00 |    100.00 
    -------------------+----------------------+----------
                 Total |     38.00      62.00 |    100.00
    http://publicationslist.org/eric.melse

    Comment


    • #3
      Dear Eric,

      The commands donĀ“t. Besides I would like to use the "svy tabulate".
      Can you help me with this?
      Thank you in advance.

      Best regards

      Comment


      • #4
        Hello Ana. When I tried to run your command, I discovered that your svyset command was missing. So I took a guess at it. Does this give you what you want?

        Code:
        // My guess at the needed -svyset- command
        svyset pid [pweight=pidp]
        // Ana's result showing overall proportions
        svy linearized: tabulate i_sex i_scghqd
        // With row and col options added
        svy linearized: tabulate i_sex i_scghqd, row col
        Output from the last line above:

        Code:
        . svy linearized: tabulate i_sex i_scghqd, row col
        (running tabulate on estimation sample)
        
        Number of strata   =         1              Number of obs     =            100
        Number of PSUs     =        23              Population size   =  6,551,599,784
                                                    Design df         =             22
        
        ------------------------------------------------------------
                  |                     i_scghqd                    
            i_sex |  More so   Same as   Less so  Much les     Total
        ----------+-------------------------------------------------
             male |    .1108     .8889         0   3.0e-04         1
                  |    .5712     .3769         0         1     .3754
                  |
           female |      .05     .8834     .0666         0         1
                  |    .4288     .6231         1         0     .6246
                  |
            Total |    .0728     .8855     .0416   1.1e-04         1
                  |        1         1         1         1         1
        ------------------------------------------------------------
          Key:  row proportion
                column proportion
        
          Pearson:
            Uncorrected   chi2(3)         =    3.7100
            Design-based  F(1.42, 31.22)  =    1.1810     P = 0.3052
        --
        Bruce Weaver
        Email: [email protected]
        Version: Stata/MP 18.5 (Windows)

        Comment

        Working...
        X