Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
write_dta: dates are off by 10 years #139
When I open date-test.dta in Stata, the variable has the value 16769. After I apply the %td format, Stata shows it as 29nov2005.
Stata stores dates as "days since 01jan1960 (01jan1960 = 0)".
I don't know much about Rcpp, but I think the problem is here: https://github.com/hadley/haven/blob/8f65dbc289a30cfd651bf5b201700d4ed1d15cdc/src/DfWriter.cpp#L50
Dates go into that branch and are coerced to numeric using the R epoch. They need to be handled separately. Unfortunately, there is no specific SEXPTYPE for Dates.