Announcement

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

  • Descriptive Data at the country-firm-year level

    Hello,

    I am finding difficulty in tabulating my descriptive statistics in an easy and efficient way. Could you please help me figure out the descriptive statistics for each firm (per country) averaged across all years

    Below is a sample of my data:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str7 Country str4 Year str7 Firm str14 num_of_offices str18 num_of_partners str8 distance
    "Belgium" "2009" "ABC" "6"  "9"  "2000"
    "Belgium" "2010" "ABC" "5"  "10" "1000"
    "Belgium" "2011" "ABC" "4"  "11" "2000"
    "Belgium" "2012" "ABC" "3"  "12" "3000"
    "Belgium" "2010" "XYZ" "10" "15" "5000"
    "Belgium" "2011" "XYZ" "11" "16" "6000"
    "Belgium" "2012" "XYZ" "12" "17" "7000"
    "France"  "2015" "MNO" "1"  "11" "2000"
    "France"  "2014" "MNO" "2"  "12" "3000"
    "France"  "2015" "TUV" "3"  "13" "5000"
    "France"  "2014" "TUV" "4"  "20" "6000"
    "France"  "2013" "DEF" "5"  "21" "8000"
    "France"  "2012" "DEF" "6"  "22" "9000"
    end
    Accordingly, I would like to tabulate my results in the following format:
    NUM_OF_OFFICES NUM_OF_PARTNERS DISTANCE
    Country Firm Mean SD Q1 Median Q3 Mean SD Q1 Median Q3 Mean SD Q1 Median Q3
    Belgium ABC
    XYZ
    France MNO
    TUV
    DEF
    Thanking you in advance
    Maysam

  • #2
    such a table will be very wide - the following is incomplete but should get you started:
    Code:
    . destring num_of_offices, replace
    num_of_offices: all characters numeric; replaced as byte
    
    . table (Country Firm) (result), stat(mean num_of_offices) stat(sd num_of_offices)
    
    --------------------------------------------
                |      Mean   Standard deviation
    ------------+-------------------------------
    Country     |                              
      Belgium   |                              
        Firm    |                              
          ABC   |       4.5             1.290994
          XYZ   |        11                    1
          Total |  7.285714             3.638419
      France    |                              
        Firm    |                              
          DEF   |       5.5             .7071068
          MNO   |       1.5             .7071068
          TUV   |       3.5             .7071068
          Total |       3.5             1.870829
      Total     |                              
        Firm    |                              
          ABC   |       4.5             1.290994
          DEF   |       5.5             .7071068
          MNO   |       1.5             .7071068
          TUV   |       3.5             .7071068
          XYZ   |        11                    1
          Total |  5.538462             3.454837
    --------------------------------------------
    see
    Code:
    help table
    for other helpful options including those for title and formatting

    Comment


    • #3
      Thank you Rich Goldstein , I am just not getting how to make it wider (sideway).
      I tried: table (country auditfirm) (result), stat(mean num_of_offices num_of_partners) stat(median num_of_offices num_of_partners) but it didnt work.

      Comment


      • #4
        as the FAQ say, "didn't work" without telling us how it did not work is of no help; I note that the following works for me:
        Code:
        . table (Country Firm) (result), stat(mean num_of_offices) stat(sd num_of_offices) stat(median num_of_offices)
        
        -----------------------------------------------------
                    |      Mean   Standard deviation   Median
        ------------+----------------------------------------
        Country     |                                        
          Belgium   |                                        
            Firm    |                                        
              ABC   |       4.5             1.290994      4.5
              XYZ   |        11                    1       11
              Total |  7.285714             3.638419        6
          France    |                                        
            Firm    |                                        
              DEF   |       5.5             .7071068      5.5
              MNO   |       1.5             .7071068      1.5
              TUV   |       3.5             .7071068      3.5
              Total |       3.5             1.870829      3.5
          Total     |                                        
            Firm    |                                        
              ABC   |       4.5             1.290994      4.5
              DEF   |       5.5             .7071068      5.5
              MNO   |       1.5             .7071068      1.5
              TUV   |       3.5             .7071068      3.5
              XYZ   |        11                    1       11
              Total |  5.538462             3.454837        5
        -----------------------------------------------------

        Comment

        Working...
        X