En indlejret tekst med ukendt tegns?t er blevet fjernet... Navn: ikke tilg?ngelig Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070613/71a9f04c/attachment.pl
Rina Miehs wrote:> Hello > > i have a data frame in R that some SAS users need to use in their > programs, and they want it in a dat file, is that possible?What is a "dat" file?> and which functions to use for that?I *guess* write.table() will do the trick, given "dat" is what I guess it is... Uwe Ligges> my data frame is like this: > >> out13[1:100,] > farid niveau1 niveau3 > p1 p3 antal1 > 2 10007995 0.0184891394 4.211306e-10 5.106471e-02 2.594580e-02 > 3 > 9 10076495 0.0140812953 3.858757e-10 1.065804e-01 3.743271e-02 > 3 > 10 10081892 0.0241760590 7.429612e-10 1.628295e-02 3.021538e-04 > 6 > 13 10101395 0.0319517576 3.257375e-10 2.365204e-03 6.633232e-02 > 19 > 16 10104692 0.0114040787 3.661169e-10 1.566721e-01 4.550663e-02 > 4 > 17 10113592 0.0167586526 4.229634e-10 6.922003e-02 2.543987e-02 > 2 > 18 10113697 0.0259205504 2.888646e-10 1.096366e-02 9.118995e-02 > 6 > 22 10121697 -0.0135341273 -5.507914e-10 1.157417e-01 5.501947e-03 > 16 > 28 10146495 0.0093514076 3.493487e-10 2.041883e-01 5.340801e-02 > 4 > 29 10150497 0.0091611504 3.455925e-10 2.089893e-01 5.531904e-02 > 4 > 36 10171895 0.0089116669 2.956742e-10 2.153844e-01 8.614259e-02 > 4 > 42 10198295 0.0078515166 3.147140e-10 2.437943e-01 7.314111e-02 > 5 > > > Thanks > > Rina > > > > > [[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.
One solution: Use 'write.csv' (or write.csv2) in R to output a csv file. Then import it in SAS (by default, it imports into the "work" library; then you need to copy into another libray to have the SAS file). Christophe On 6/13/07, Rina Miehs <rmi@danishmeat.dk> wrote:> > Hello > > i have a data frame in R that some SAS users need to use in their > programs, and they want it in a dat file, is that possible? > and which functions to use for that? > > my data frame is like this: > > > out13[1:100,] > farid niveau1 niveau3 > p1 p3 antal1 > 2 10007995 0.0184891394 4.211306e-10 5.106471e-02 2.594580e-02 > 3 > 9 10076495 0.0140812953 3.858757e-10 1.065804e-01 3.743271e-02 > 3 > 10 10081892 0.0241760590 7.429612e-10 1.628295e-02 3.021538e-04 > 6 > 13 10101395 0.0319517576 3.257375e-10 2.365204e-03 6.633232e-02 > 19 > 16 10104692 0.0114040787 3.661169e-10 1.566721e-01 4.550663e-02 > 4 > 17 10113592 0.0167586526 4.229634e-10 6.922003e-02 2.543987e-02 > 2 > 18 10113697 0.0259205504 2.888646e-10 1.096366e-02 9.118995e-02 > 6 > 22 10121697 -0.0135341273 -5.507914e-10 1.157417e-01 5.501947e-03 > 16 > 28 10146495 0.0093514076 3.493487e-10 2.041883e-01 5.340801e-02 > 4 > 29 10150497 0.0091611504 3.455925e-10 2.089893e-01 5.531904e-02 > 4 > 36 10171895 0.0089116669 2.956742e-10 2.153844e-01 8.614259e-02 > 4 > 42 10198295 0.0078515166 3.147140e-10 2.437943e-01 7.314111e-02 > 5 > > > Thanks > > Rina > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >-- Christophe Pallier (http://www.pallier.org) [[alternative HTML version deleted]]
At 09:05 13/06/2007, Rina Miehs wrote:>Hello > >i have a data frame in R that some SAS users need to use in their >programs, and they want it in a dat file, is that possible? >and which functions to use for that?Does library(foreign) ?write.foreign get you any further forward?> >my data frame is like this: > > > out13[1:100,] > farid niveau1 niveau3 >p1 p3 antal1 >2 10007995 0.0184891394 4.211306e-10 5.106471e-02 2.594580e-02 > 3 >9 10076495 0.0140812953 3.858757e-10 1.065804e-01 3.743271e-02 > 3 >10 10081892 0.0241760590 7.429612e-10 1.628295e-02 3.021538e-04 > 6 >13 10101395 0.0319517576 3.257375e-10 2.365204e-03 6.633232e-02 >19 >16 10104692 0.0114040787 3.661169e-10 1.566721e-01 4.550663e-02 > 4 >17 10113592 0.0167586526 4.229634e-10 6.922003e-02 2.543987e-02 > 2 >18 10113697 0.0259205504 2.888646e-10 1.096366e-02 9.118995e-02 > 6 >22 10121697 -0.0135341273 -5.507914e-10 1.157417e-01 5.501947e-03 >16 >28 10146495 0.0093514076 3.493487e-10 2.041883e-01 5.340801e-02 > 4 >29 10150497 0.0091611504 3.455925e-10 2.089893e-01 5.531904e-02 > 4 >36 10171895 0.0089116669 2.956742e-10 2.153844e-01 8.614259e-02 > 4 >42 10198295 0.0078515166 3.147140e-10 2.437943e-01 7.314111e-02 > 5 > > >Thanks > >Rina > > > > > [[alternative HTML version deleted]]Michael Dewey http://www.aghmed.fsnet.co.uk