Announcement

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

  • Tables, tabulate, two way-table, matrix, macros

    Good evening to everyone,
    I am analyzing enterprise data, and in the descriptives I would like to create a double-entry table with:
    - company areas and
    -classifications(grading)
    within each cell the gender gap in wages.

    I already got something similar separately by gender (below), but I'd really like to be able to put gender wage differences (absolute value and/or t-test and/or percentage of female wage over male wage) inside the cells.

    Code:
     
     by Female, sort: tabulate area grading, summarize(Income) nostandard   
     by Female, sort: tabulate area grading, summarize(lnYhour) nostandard

    Somebody have a kindly suggestion? Many thanks in advance for your time!!

  • #2
    crossed post: https://www.statalist.org/forums/for...-matrix-macros
    If you provide a data example, you will be more likely to get an answer. And given that Stata 17 has modified its table command, it's appropriate to explain here which version of Stata you are using.
    In Stata 16, you can try the following code, however, I doubt if the result is what you wanted.
    Code:
    table area grading Female, content(mean Income)
    Last edited by Chen Samulsion; 12 Jan 2023, 00:27. Reason: typo

    Comment


    • #3
      Many thanks Chen,
      the crossed post was actually mine (as I didn't get a reply I reformulated it a little bit better).
      I have stata 15; your commandsì helpful (even if gives me more or less the same as the previous one, but I appreciated that I could put more stuff inside like viewing together total Income and lnYhour)

      It is more or less what I want but with gender differences in wages into the cells.

      I am still working on it and many thanks for your time.


      Last edited by Chiara Tasselli; 12 Jan 2023, 01:27.

      Comment


      • #4
        The problem still is how to define the variable "gender wage differences", is it already exist in you dataset, or it should be generated by yourself before you create table, or you just want Stata to automatically generate such a variable in whatever manner? You want to put "gender wage differences" in table cells, so when you tabulate ... summarize(Income), the figures in cells mean what?
        Last edited by Chen Samulsion; 12 Jan 2023, 02:10.

        Comment


        • #5
          yes you're right!

          The fact is that I haven't found a smart way to calculate it because it depends each time on the observations that are in the cells: I would like to have the gender differences in the average wages of females and males in each cell (that is a combination of different gradings and areas).

          My trouble is exactly how to generate it.

          Comment


          • #6
            Still no data example! Here is some technique, and note that tabdisp will show more than one thing in a cell.

            Code:
            bysort area grading : egen meanf = mean(cond(Female == 1, Income, .)) 
            
            by area grading: egen meanm = mean(cond(Female == 0, Income, .) 
            
            gen diff = meanm - meanf 
            
            tabdisp area grading, c(diff)
            (It really was vital in this thread to tell us that you are using Stata 15.1. Otherwise someone could have wasted their time telling you about the new stuff in 17. Please do read the entire FAQ now, because you are still missing several points in it, including etiquette on starting new threads.)


            Comment


            • #7
              Originally posted by Nick Cox View Post
              Still no data example! Here is some technique, and note that tabdisp will show more than one thing in a cell.

              Code:
              bysort area grading : egen meanf = mean(cond(Female == 1, Income, .))
              
              by area grading: egen meanm = mean(cond(Female == 0, Income, .)
              
              gen diff = meanm - meanf
              
              tabdisp area grading, c(diff)
              (It really was vital in this thread to tell us that you are using Stata 15.1. Otherwise someone could have wasted their time telling you about the new stuff in 17. Please do read the entire FAQ now, because you are still missing several points in it, including etiquette on starting new threads.)

              Thank you so much for the advices!! And sorry for the misuse of the forum, I will read it.

              Comment

              Working...
              X