Announcement

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

  • Export raw STATA file to Excel with value labels

    Dear All

    Please advise how I can export my data to excel and preserve the format of variables including the values and their labels.

  • #2
    Excel does not work that way unfortunately; I believe you can only pick either the labeled version or the numeric version. One way could be breaking them into two variables, one the number and one the string version of the label. Here is a possible way to do it:

    Code:
    sysuse nlsw88, clear
    
    ds, has(vallabel)
    
    foreach x in `r(varlist)'{
        decode(`x'), gen(str_`x')
        order str_`x', after(`x')
        label values `x'
    }
    Then proceed to export as usual.

    Comment

    Working...
    X