Q:

convert SAS date format to R

I read in a sas7bdat file using the haven package. 
One column has dates in the YYQ6. format. 
I R this is converted to numbers like -5844, 0, 7121, ..
How can I convert this to a year format? I have no access to SAS but these values should be birth dates.

A:

Bit of Research first. SAS uses as Zero 1st of January 1960 (see http://support.sas.com/publishing/pubcat/chaps/59411.pdf) so if you want the year of the data (represented by your number) it should be
format(as.Date(-5844, origin="1960-01-01"),"%Y")

and you get in this case
1944

is that correct? is what you are expecting?
To learn more on the data type YYQ6. check this Support article from SAS
http://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n02xxe6d9bgflsn18ee7qaachzaw.htm
Let me know if is working.
Umberto

