dbosak01 / libr

An R package to create data libraries and data dictionaries.
27 stars 1 forks source link

Format issues for date and datetime variables reading from SAS dataset #157

Closed Raphael0522 closed 5 months ago

Raphael0522 commented 6 months ago

The SAS formats are missing when we use libname to read SAS data. For example, a variable with date format is converting to a numeric one. In addition, the converted number is not the same as the one in the origin SAS dataset. For example, '2019-08-14' is converted to 18122 by using libname function, however, it's actually 21775 when we remove the format in SAS dataset.

dbosak01 commented 6 months ago

Hi Raphael! Does the same thing happen when you use haven directly?

Raphael0522 commented 6 months ago

Hi David, the date and datetime format look good if I use haven package to read dataset directly. Please use the attached 'testfile.sas7bdat' to test. testfile.zip

dbosak01 commented 6 months ago

Hmm... you're right. It looks like the numeric value is the same as haven, but it is losing the Date data type. I'll have to dig into this. Give me a couple days.

dbosak01 commented 5 months ago

I appears this bug was there a long time. Thanks for noticing. Fixed now. Probably push to CRAN today.