Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Marina Selini Katsaiti
    Participant
    Post count: 4

    Hello,

    I am new to this and my questions might seem stupid, but I was wondering whether you can any advice regarding the following

    1. How to nest sum output in a by command, suppose I want the mean expenditures (edu food housing etc.) by level of disability. How can I nest the output in a table similar to nesting the regression results?

    2. Is there a way I can tell stata to put the categories of the by command in a different order?

    Thank you
    Selini

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Welcome to the Forum Selini

    Yes you create summary statistics using a grouping variable. See the following example. I use industry as a grouping variable and find descriptive statistics for the variable wage.

    sysuse nlsw88, clear
    bys industry : asdocx sum wage, replace

    Summary statistics by grouping variable asdocx

    I think you should post the second question as a new topic so that it is answered there.

    Marina Selini Katsaiti
    Participant
    Post count: 4

    Yes, exactly this is how I do it. However, I was wondering in the case you want to summarize many variables (like wage) by industry (and suppose you only need their means) whether its possible to nest the results?

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    If you just need the mean for each industry, then you use the option stat(). See for example:

    sysuse nlsw88, clear
    bys industry : asdocx sum wage, stat(mean) replace
    
    ----+---------------------------------
      1 |                            wage 
    ----+---------------------------------
      2 |Ag/Forestry/Fisheries      5.621 
      3 |Business/Repair Svc        7.516 
      4 |Construction               7.565 
      5 |Entertainment/Rec ~c       6.724 
      6 |Finance/Ins/Real E~e       9.843 
      7 |Manufacturing              7.502 
      8 |Mining                     15.35 
      9 |Personal Services          4.401 
     10 |Professional Servi~s       7.871 
     11 |Public Administrat~n       9.148 
     12 |Transport/Comm/Uti~y      11.443 
     13 |Wholesale/Retail T~e       6.126 
    --------------------------------------
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.