Announcement

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

  • Labeling columns using outreg in a loop

    Hi everyone,

    I'm trying to label my regression columns using outreg in a loop.

    I've tried the following so far:

    outreg, clear
    forval i = 1/3 {
    set more off
    poisson time_spent inc75 male edu1 hh_size age sav pwb_tot health_tot sc_tot rav90 if activity==`i'
    outreg, starloc(1) ctitle("", Paid Work)
    outreg, merge nosubstat ctitle("", Non-Paid Work)
    outreg, merge nosubstat ctitle("", Non-IGA)
    }

    outreg, clear
    forval i = 1/3 {
    set more off
    poisson time_spent inc75 male edu1 hh_size age sav pwb_tot health_tot sc_tot rav90 if activity==`i'
    outreg, starloc(1) merge ctitle("", Paid Work, "", Non-Paid Work,"", Non-IGA)
    }


    Both don't seem to work. Will appreciate if someone can provide the small tweak i'm looking for?

    Thanks

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long time_spent float(inc75 male) byte(edu1 hh_size age sav) float(pwb_tot health_tot sc_tot rav90) byte activity
     3 1 1 0  5 30 0 29 25 38 0 3
     7 1 1 0  5 30 0 29 25 38 0 1
    14 1 1 0  5 30 0 29 25 38 0 3
     3 1 0 0  7  . 1 17 25 40 1 1
     4 1 0 0  7  . 1 17 25 40 1 2
     8 1 0 0  7  . 1 17 25 40 1 3
     7 1 0 0  7  . 1 17 25 40 1 1
     2 1 0 0  7  . 1 17 25 40 1 3
     1 1 0 0  4 23 0 33 31 46 0 3
     6 1 0 0  4 23 0 33 31 46 0 1
     3 1 0 0  4 23 0 33 31 46 0 2
    14 1 0 0  4 23 0 33 31 46 0 3
     2 0 1 0  7 20 1 15 23 37 0 3
     9 0 1 0  7 20 1 15 23 37 0 3
     2 0 1 0  7 20 1 15 23 37 0 2
     6 0 1 0  7 20 1 15 23 37 0 1
     5 0 1 0  7 20 1 15 23 37 0 .
     4 1 0 0  5 26 0 36 28 39 0 1
    17 1 0 0  5 26 0 36 28 39 0 3
     2 1 0 0  5 26 0 36 28 39 0 3
     1 1 0 0  5 26 0 36 28 39 0 2
     7 0 1 0  6 18 1 22 23 42 0 3
     1 0 1 0  6 18 1 22 23 42 0 3
     5 0 1 0  6 18 1 22 23 42 0 3
    11 0 1 0  6 18 1 22 23 42 0 1
     2 1 1 0  3 25 1 35 31 35 0 .
    10 1 1 0  3 25 1 35 31 35 0 1
     3 1 1 0  3 25 1 35 31 35 0 3
     9 1 1 0  3 25 1 35 31 35 0 3
    12 1 0 0  9 18 0 44 26 42 0 3
     2 1 0 0  9 18 0 44 26 42 0 3
    10 1 0 0  9 18 0 44 26 42 0 3
     2 0 0 0  7  . 0 22 34 41 0 1
    15 0 0 0  7  . 0 22 34 41 0 3
     4 0 0 0  7  . 0 22 34 41 0 1
     3 0 0 0  7  . 0 22 34 41 0 3
     1 0 1 0  5 28 1 32 23 35 1 3
    14 0 1 0  5 28 1 32 23 35 1 3
     4 0 1 0  5 28 1 32 23 35 1 3
     5 0 1 0  5 28 1 32 23 35 1 1
     4 0 1 0 11 22 1 27 33 36 0 1
     1 0 1 0 11 22 1 27 33 36 0 3
     1 0 1 0 11 22 1 27 33 36 0 .
     9 0 1 0 11 22 1 27 33 36 0 3
     5 0 1 0 11 22 1 27 33 36 0 3
     4 0 1 0 11 22 1 27 33 36 0 1
     5 0 1 0  7 19 0 28 24 37 0 1
    11 0 1 0  7 19 0 28 24 37 0 3
     4 0 1 0  7 19 0 28 24 37 0 1
     1 0 1 0  7 19 0 28 24 37 0 2
    end
    label values male gender
    label def gender 0 "female", modify
    label def gender 1 "male", modify
    label values sav qn7_11
    label def qn7_11 0 "No", modify
    label def qn7_11 1 "Yes", modify
    label values activity time1
    label def time1 1 "Paid Work", modify
    label def time1 2 "Unpaid Work", modify
    label def time1 3 "Non-IGA", modify
Working...
X