Hi,

If I am using R 2.4.0, and work with write.foreign command, I get the
datetime format as 01Dec2006 00:00:00, because the built in function
(foreign:::writeForeignSAS) has the fixed format for Datetimes and the
format is "%d%b%Y %H:%M:%S". And that's the reason why I get the
datetime as 01Dec2006 00:00:00 instead of 2006-12-01 00:00:00.

So, R users, could I make this code flexible to use any datetime
formats? Also where could I see locate this code in the foreign package
itself?

Thank you,
Shubha.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shubha Karanth
Sent: 20. joulukuuta 2006 17:15
To: [email protected]
Subject: [R] R Version Problem in using write.foreign+SAS

Hi experts,



I have a problem in Write.foreign command (SAS).



I have a data frame called d.

>d

 Datetime

2006-12-01 00:00:00

2006-12-01 00:10:00

2006-12-01 00:20:00

2006-12-01 00:30:00

2006-12-01 00:40:00

>class(d$Datetime)

[1] "POSIXt"  "POSIXct"



Then I tried with,



write.foreign(d,"Z:\\try_i.sas7bdat"," Z:\\try_i.sas
",package="SAS",dataname="g")



If I use R 2.4.0 version I get the below text file generated.



"01Dec2006 00:00:00"

"01Dec2006 00:10:00"

"01Dec2006 00:20:00"

"01Dec2006 00:30:00"

"01Dec2006 00:40:00"





If I use R 2.2.0 version I get the below text file generated.



2006-12-01 00:00:00

2006-12-01 00:10:00

2006-12-01 00:20:00

2006-12-01 00:30:00

2006-12-01 00:40:00





But I need to use R 2.4.0 and get the text file generated by R 2.2.0.





Could somebody help me on this?



Thank you.

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to