Suppose I import a bunch of SAS dates into R. How well does that work?

Not very. First is the import itself. If you use read.csv, R will try to import the datetime field as factors, which creates a big ol mess. Let’s fix that first. When you use read.csv, remember to include this phrase:


in the read.csv function as a parameter. That will import the SAS datetime field as a string. OK, now lets do our conversion:

datetime.field=strptime(SAS_DATE_TIME, “%d%b%Y:%H:%M:%S.%s”)

And you’re done. Problem solved.