Announcement

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

  • Keep value labels after collapse?

    Hi all,

    I am trying to keep value labels for my variables after a collapse. I am in a, possibly rare, situation in which the labels are still relevant after the collapse. Long story short, I take a long format parent-child file, create unique variables for each child number, then collapse to a respondent level long format with child characteristics wide.

    When I collapse, I lose variable labels and value labels. I used the following resource to retain variable labels: https://www.stata.com/support/faqs/d...with-collapse/ , but I am struggling to convert this into value labels. Any insight is greatly appreciated.

  • #2
    See

    Code:
    help label
    for label save. That is, save your labels to a .do file and then run the do file after the collapse to re-define the labels. You may find describe and ds useful to keep track of which variables have which value labels.

    Comment


    • #3
      In addition to Nick's excellent advice, you will also want to run a bunch of -label values- commands on your variables after you have done what he recommends. Although the advice in #2 will redefine the labels in the newly collapsed data set, it won't actually apply them to the variables--you have to do that separately.

      Comment


      • #4
        Indeed; that last step is essential.

        Comment

        Working...
        X