Skip to content
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

larmarange opened this issue Jun 23, 2015 · 1 comment

Importing dates and datetime with read_dta #80

larmarange opened this issue Jun 23, 2015 · 1 comment


Copy link

@larmarange larmarange commented Jun 23, 2015

I just updated haven to the last version and I have prepared a Stata file available at

  • 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.
Copy link

@hadley 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.
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants