Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I loaded a sas7bdat file using the sas7bdat package, but the dates are converted to a num like this:

sas <- c(16922, 17045, 17014, 16983)

I tried

rPOSIX <- as.POSIXct(sas,origin='1960-01-01')

as mentioned here but it's wrong. I don't have access to SAS but the dates should be around the year 2006.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

As my previous comment, here is a working example, where the origin argument is set like that because of a specific SAS setting, which sets the origin date to 1960-01-01, here informations:

 as.Date(sas, origin = "1960-01-01")
[1] "2006-05-01" "2006-09-01" "2006-08-01" "2006-07-01"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...