Hi yf, On Thu, Feb 17, 2011 at 2:35 PM, yf <chang...@umn.edu> wrote: > > i am trying to convert sas file into csv. I used write.csv(a, > file="cool.csv") but nothing come out. i don't know why. Thanks. > > > library(Hmisc) > a<- sasxport.get("C:\\Users\.....")
Let's back up a little bit. What type of file are you trying to read into R with this statement? Did you make sure it was a SAS XPORT format? SAS files often come in the native .sas7bdat format, which R cannot read (it is proprietary). At this point, try taking a look at your object "a". At the console you can type: class(a) str(a) and see what the output says. Is it a data frame? A list? or .... ? Even if the data is read into R properly, write.csv() may not be able to properly write all classes of data. You might also try: print(a) to make sure there is actually data to be written and it is not just an empty dataset. > write.csv(a, file="cool.csv") Assuming "a" is a matrix or data frame or can readily be coerced to such, this line should be fine. Just as a note, if it is a .sas7bdat file, Revolution Analytics now provides software that can read it into R. There is normally a charge, but it is free for academics, which, judging by your email address, you are. http://www.revolutionanalytics.com/news-events/news-room/2011/revolution-analytics-unlocks-sas-data-for-r.php Cheers, Josh > -- > View this message in context: > http://r.789695.n4.nabble.com/convert-the-sas-file-into-csv-in-R-tp3311769p3311769.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org 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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ ______________________________________________ R-help@r-project.org 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.