Announcement

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

  • Outreg2 Help

    I am trying to outreg information into an excel file. I have a large loop which runs a regression each time and then outregs the information via outreg2. This part works just fine. I am also trying to have a couple other statistics added to the same column of each outreg. For example I am running a correlation and storing it in a macro called Corr1. I would like to then add this correlation to the same column right after the R^2 but it's not working. Instead the statistics overlap each other or end up in the same column, either way they are not lined up helpfully. I've tried addstat as well but I always just got "invalid syntax". Here's the code I have :

    outreg2 using "filename", append ctitle(`j', `k') addtext(`D',`Corr1', `Corr2', `Corr3', `Corr4', `Corr5')

    D: Some r^2 ratio stored as a local macro
    CorrX: Five different correlations with lags stored as macros as well.
    The ctitle part is working just fine. j and k are just taken from the loop to give a title for each regression.

    Does anyone know what I might be doing wrong?
    Thanks,
    Ben

  • #2
    Hi try:
    outreg2 using "filename", append ctitle(`j', `k') addtext("`D'"";""`Corr1'"";" "`Corr2'"";" "`Corr3'"";" "`Corr4'"; "`Corr5'")

    Comment


    • #3
      Thanks for suggestion but unfortunately that didn't work. I just ran it for a 5 year test and it's giving me all 30 of the numbers but not at all where they should be so I can't figure out what each one is. I uploaded a screen shot of what it looks like.
      Attached Files

      Comment


      • #4
        Sorry here it is
        Click image for larger version

Name:	Screen Shot 2015-01-10 at 12.08.25 PM.png
Views:	2
Size:	49.1 KB
ID:	620866

        Comment


        • #5
          This code will help you to figure out what each of your local equal to. I hope it will be more helpful.

          Code:
          outreg2 using "filename", append ctitle(`j', `k') addtext("D: Some r^2 ratio=","`D'","Correlation 1=", "`Corr1'","Correlation 2=", "`Corr2'" ///
          ,"Correlation 3=","`Corr3'","Correlation 4=","`Corr4'","Correlation 5=","`Corr5'")

          Comment


          • #6
            Oded Mcdossi you are amazing. Thank you so much. That actually completely fixed the problem. I'll be honest though I'm very confused as to why. I emailed the creator of outreg2 but he has not gotten back to me. Can you possibly explain why that fixed the problem? No it's perfect set up so that in the first column it says "D ratio:" and then in that same row it has the D measure for each respective year, which is what I wanted but could not get before. The same thing happens with all the correlations.
            Thanks again,
            Ben

            Comment


            • #7
              I changed using this one, but it doesnt work....

              drop(0b.`var'#0b.post 0b.`var'#1o.post 1o.`var'#0b.post)

              Comment

              Working...
              X