Announcement

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

  • Outreg not writing variable value labels for dummy/cat. vars

    Hi Statalist,

    I am using outreg after running some regressions to produce tables for a journal article.

    To produce the tables I tell Stata something just like this:

    Code:
    xi: svy: regress y x1 x2 i.x3 i.x4
    
    outreg using filename.doc, se varlabels replace
    When I run these lines of command variable value labels do not show up in my tables for categorical/binary variables. Is that a limitation of outreg? I have these variables labeled with value labels.

    Thank you!
    Last edited by Rebecca Boehm; 14 Jul 2016, 14:35.

  • #2
    Perhaps this is a result of using xi: - which Stata advises against in help xi. Your command should, it seems to me, work equally well omitting xi: as long as you have Stata 11.0 or later (see help factor variables), and perhaps that will solve the outreg problem. Give it a try, it can't hurt.

    Comment


    • #3
      William, thank you, I will try that!

      Comment


      • #4
        Actually it didn't work! I removed xi: and the labels are still not showing up for the factor variables! I wonder why this could be. I'm going to have to do some more investigating.

        Comment


        • #5
          My apologies for sending you off in the wrong direction (although it's a good thing to have dropped xi:). It's apparent on further inspection that the failure to use value labels for factor variables is a limitation of outreg's reliance on e(b) for the factor variables values as well as the coefficient estimates. That is, outreg seems to do as well as it can, given that Stata apparently doesn't provide an easy way to reproduce the labeling it provides in the printed tables.

          Comment


          • #6
            William, thanks for your reply and no worries. I actually contacted the author of outreg to let him know about the issue. Outreg2 also works like a charm for correctly labeling cat. vars using svy.

            Comment


            • #7
              Hi Rebecca Boehm, William Lisowski & Statalisters,

              I looked at
              Code:
              Outreg2
              and I unfortunately didn't find
              Code:
              svy
              as an option to label categorical variables created due to a regression with
              Code:
              xi:
              .
              I would appreciate if you told me exactly how you managed to assign your own value labels to the vars generated by xi.
              I tried with the following loop:
              Code:
              foreach diff in varone vartwo {;
              use march30-2017.dta", clear;
              xi: cloglog dependentvar varlist `diff'  i.subject, cluster(id);
              estimates store `diff';
              qui outreg,
              varlabels
               `merge';
              local merge "merge";
                };
              But I cannot manage to change the variable labels of the vars created by
              Code:
              xi; cloglog varlist i.subject
              Thanks in advance.
              Last edited by Victor Cruz; 13 Apr 2017, 02:54. Reason: summarized my code
              Victor Cruz

              Comment

              Working...
              X