New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing dates and datetime with read_dta #80

Closed
larmarange opened this Issue Jun 23, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@larmarange
Copy link
Contributor

larmarange commented Jun 23, 2015

I just updated haven to the last version and I have prepared a Stata file available at http://joseph.larmarange.net/stata_dates.dta

  • Variable date has %td format and is imported correctly.
  • datetime has %tc format and is imported correctly
  • date2 has %tdCCYY-NN-DD format, which means it's a date with custom display format. It's not imported as a date. In fact, any format starting with %td, regardless of the following character should be imported as a date (same thing with other Stata formats)
  • datetime2 has %tC format and seems to be imported correctly
  • year has %ty format (year format). It's imported correctly as an atomic vector, containing the year
  • months, week, quarter and halfyear are specific format from Stata, respectively %tm, %tw, %tq and %th. I'm not sure that there are corresponding formats available in R. So far they are imported as integers.
@hadley

This comment has been minimized.

Copy link
Member

hadley commented Jun 23, 2015

That should do it - let me know if you find any other formats that don't import correctly.

@lock lock bot locked and limited conversation to collaborators Jun 27, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.