Hi Paul, Jim, Dennis, and others,
 
I got RODBC and SQL Server to create a date variable in R (see below). I'm pretty sure the commands I was issuing before were working but that I was stripping off the date class every time I submitted the command "fix(mydata)." So I kept getting the mistaken impression that what I was doing wasn't working.
 
One thing I've noticed is that the class for my date is of the type POSIX. When I issue the command "head(mydata$ae_datestarted)", I get "CDT" tacked onto my date. I'll spend some additional time investigating this, but if an answer about how to get a class of date using my SQL command seems obvious to someone please let me know.
 
Thanks,
 
Paul
 
> mydata <- sqlQuery(channel, 
+ "select subject_number, 
+ ae, 
+ ae_ctcgrade, 
+ ae_relationship, 
+  ae_serious, 
+ cast(ae_datestarted as datetime) as ae_datestarted,  
+ ae_dateended, 
+ ae_ongoing
+  from adverse_events_detail")
> 
> class(mydata$ae_datestarted)
[1] "POSIXt"  "POSIXct"
> mode(mydata$ae_datestarted)
[1] "numeric"
> 
> head(mydata$ae_datestarted)
[1] "2008-10-23 CDT" "2008-10-21 CDT" "2008-10-24 CDT" "2008-10-25 CDT"
[5] "2008-10-23 CDT" "2008-10-31 CDT"

 


      __________________________________________________________________
[[elided Yahoo spam]]
avourite sites. Download it now

	[[alternative HTML version deleted]]

