Announcement

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

  • Categorical Variables names in Mutiple Regression

    I am using outreg2 to create a table with multiple regressions based on categorical variables:

    For example, my line of code is:
    Code:
    bysort Sector: outreg2 using results_by_sectors.xls, replace dec(2) keep(log_tfp_leader_growth years_schooling_normalized tfp_gap_years_school_norm i_rd_go tfp_gap_i_rd) title("Regressions By Sectors")  label: reg log_tfp_growth log_tfp_leader_growth years_schooling_normalized tfp_gap_years_school_norm, robust
    All going well except, one thing the table instead of using the names/labels of the categorical variable Sector
    pops out as Sector 1, Sector 2, Sector 3 etc ... like


    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	17.0 KB
ID:	1448518


    but the labels/names of each Sector are:


    Code:
    tab Sector
    
            ind |      Freq.     Percent        Cum.
    ------------+-----------------------------------
          10-12 |        236        3.88        3.88
          13-15 |        236        3.88        7.76
          16-18 |        236        3.88       11.64
             19 |        220        3.62       15.26
          20-21 |        220        3.62       18.88
          22-23 |        236        3.88       22.76
          24-25 |        220        3.62       26.38
          26-27 |        220        3.62       30.00
             28 |        220        3.62       33.62
          29-30 |        220        3.62       37.24
          31-33 |        220        3.62       40.86
              A |        284        4.67       45.53
              B |        284        4.67       50.20
            D-E |        252        4.14       54.34
              F |        284        4.67       59.01
              G |        284        4.67       63.68


    How I should modiy my outreg code so instead of getting Sector 1 Sector 2 in the column names of each regression to get the labels of each Sector as shown above? (10-12, 13-15 etc etc )
    Attached Files

  • #2
    I wonder whether you have tried - label(insert) - as the option.
    Best regards,

    Marcos

    Comment


    • #3
      Sadly this does not work. It shows the labels of the variables (co-variates) not of the categories. As shown in the pic, I need the labels of the categorical variables to appear in the title of the columns. Tried the - label(insert) but this only shows the labels of the covariates.

      Comment


      • #4
        Have you tried to column title option?

        Often, it is easier to neaten up your table directly, output the results to word using outreg2, and then cut and paste the results into the neatened table. I usually want different row and column labels than outreg2 generates. I know you can do more within outreg2 (or other output routines) but I'm not sure it is worth the trouble.

        Comment


        • #5
          @Phil BromileyCan you please provide an example of a code?

          However, I should say that in other forums they pointed out to me that outreg2, is not possible to do what I want do.

          Comment

          Working...
          X