0
votes

I have ran a regression of type

reg foo I.year 

and would like to plot the yearly effects. The regression result table looks like this:

  foo |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        year |
       2001  |   .1253994   .0047826    26.22   0.000     .1160255    .1347734
       2002  |     .06168   .0045566    13.54   0.000      .052749    .0706109
       2003  |   .1324228    .005008    26.44   0.000      .122607    .1422385
       2004  |   .1177605   .0051766    22.75   0.000     .1076143    .1279066
       2005  |   .1007163    .005018    20.07   0.000      .090881    .1105516
       2006  |   .0792936   .0047979    16.53   0.000     .0698897    .0886974

Unfortunately, when I use coefplot, vert, it says on the x-axis Survey year=2001, Survey year=2002 and so on which consumes a lot of space. I understand that coeflabels allows me to relabel coefficients, but do I have to do that for every single one of these? What if I had 30 years - is there a more generic version of relabeling it?

1

1 Answers

1
votes

Sounds like a weird solution but it did work for me. Simply add any value label to your survey year variable and it should recognize the years as their values.

In case adding any value label does not work, you can create a loop to set a value label for each year as its own year.

levelsof year, local(years)
foreach lvl of local years {
    lab def year `lvl' "`lvl'", modify
}
lab val year year