[R] FW: R Version Problem in using write.foreign+SAS

Shubha Vishwanath Karanth shubhak at ambaresearch.com
Thu Dec 21 05:54:22 CET 2006


Could I find a solution for this? Please please please... How can I
change the built in code of "foreign:::writeForeignSAS" for the format?

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Shubha Vishwanath
Karanth
Sent: Wednesday, December 20, 2006 6:06 PM
To: Shubha Karanth; r-help at stat.math.ethz.ch
Subject: Re: [R] R Version Problem in using write.foreign+SAS

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: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Shubha Karanth
Sent: 20. joulukuuta 2006 17:15
To: r-help at stat.math.ethz.ch
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]]

______________________________________________
R-help at stat.math.ethz.ch 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.

______________________________________________
R-help at stat.math.ethz.ch 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.



More information about the R-help mailing list