Announcement

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

  • Exporting dates from Stata to EXCEL

    Hello,

    I want to export data from a Stata dta file into EXCEL, so I can work with the file in R. I have been moving between the two programs become some tasks are much easier in R, than Stata and vice versa.

    In the example below, row 1 of offirstdate is displayed as 18794. In the datafile it is displayed as 6/16/2011 and when I click on the cell the value 16jun2011 is visible. I would like to be able to export or copy this date data into EXCEL so the correct date is available. Copied into EXCEL it is 6/16/2011 and R reads it as a string and when formatted into a date as a missing value, because it is not a valid date.

    This is a data except. Any advice is appreciated.

    Bob

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double(offfirstdate offlastdate)
    18794 19177
    19529 19632
    19240 19465
    19726 19792
    19768 19768
    19510 19569
    19656 19656
    18658 20126
    19812 19812
    19838 19838
    end
    format %tdnn/dd/CCYY offfirstdate
    format %tdnn/dd/CCYY offlastdate

  • #2
    Changing a date formatting option in R, fixed the problem.

    Comment

    Working...
    X