Hello I am sure this is elementary, but I can't figure it out..... I am using SAS v8.2 and R 1.4.1 on a Windows platform. I have a large (6 megabyte) file in .sd2 format. I want to import it into R. If necessary, I can create a smaller file, as I don't need all the variables that are in this file I downloaded the package foreign. I then tried to use PROC CPORT in SAS to create a transport file. It gave no error message, but I cannot find the file it wrote. I also tried the SAS Export Wizard, but this didn't work. What's the best way to do this? More specifically 1) How do I import any .sd2 file to R ? 2) Is it better to create and import small files as needed, or one huge file which would contain all the data? 3) Any other tips on how to do this? Thanks in advance Peter L. Flom, PhD Assistant Director, Statistics and Data Analysis Core Center for Drug Use and HIV Research National Development and Research Institutes 71 W. 23rd St New York, NY 10010 (212) 845-4485 (voice) (917) 438-0894 (fax) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Try the sas.get function in the Hmisc library. Hmisc is available for Linux/Unix/MacOSX and will soon be updated for Windows. http://hesweb1.med.virginia.edu/biostat/s/Hmisc.html Frank Harrell On Fri, 26 Apr 2002 09:59:09 -0400 Peter Flom <flom at ndri.org> wrote:> Hello > > I am sure this is elementary, but I can't figure it out..... > > I am using SAS v8.2 and R 1.4.1 on a Windows platform. > > I have a large (6 megabyte) file in .sd2 format. I want to import it into R. > If necessary, I can create a smaller file, as I don't need all the variables that are in this file > > I downloaded the package foreign. I then tried to use PROC CPORT in SAS to create a transport file. It gave no error message, but I cannot find the file it wrote. I also tried the SAS Export Wizard, but this didn't work. > > What's the best way to do this? > > More specifically > > 1) How do I import any .sd2 file to R ? > 2) Is it better to create and import small files as needed, or one huge file which would contain all the data? > 3) Any other tips on how to do this? > > > Thanks in advance > > > > Peter L. Flom, PhD > Assistant Director, Statistics and Data Analysis Core > Center for Drug Use and HIV Research > National Development and Research Institutes > 71 W. 23rd St > New York, NY 10010 > (212) 845-4485 (voice) > (917) 438-0894 (fax) > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- Frank E Harrell Jr Prof. of Biostatistics & Statistics Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"Peter Flom" <flom at ndri.org> writes:> Hello > > I am sure this is elementary, but I can't figure it out..... > > I am using SAS v8.2 and R 1.4.1 on a Windows platform. > > I have a large (6 megabyte) file in .sd2 format. I want to import it into R. > If necessary, I can create a smaller file, as I don't need all the variables that are in this file > > I downloaded the package foreign. I then tried to use PROC CPORT in SAS to create a transport file. It gave no error message, but I cannot find the file it wrote. I also tried the SAS Export Wizard, but this didn't work. > > What's the best way to do this? > > More specifically > > 1) How do I import any .sd2 file to R ?You don't. Not even SAS itself can do that, except on the same platform. PROC CPORT is the wrong way. The template for creating files that read.xport will accept is something like this: libname peter xport "dataset.xpt"; DATA peter.foo; SET sasuser.bar; run; You may want to change "dataset.xpt" to something with a full path so you can find it again (putting files in seemingly arbitrary locations is a common feature of so-called user-friendly software...).> 2) Is it better to create and import small files as needed, or one huge file which would contain all the data?There are pros and cons. Small files put less strain on a small system, but you need to be more careful in keeping them all up to date if the database changes. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 26 Apr 2002, Frank E Harrell Jr wrote:> Try the sas.get function in the Hmisc library. Hmisc is available for > Linux/Unix/MacOSX and will soon be updated for Windows. > http://hesweb1.med.virginia.edu/biostat/s/Hmisc.htmlSimilar functionality is available in the most recent version of the "foreign" package as well, with read.ssd() -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
It may be worth pointing out that the new read.ssd has to launch SAS to convert to xport format. The sas.get philosophy is that if you are going to have to do that you might as well ask the sas session to dump the data to ASCII files, with optional restriction to a subset of the variables. That way you can fetch all the SAS attributes such as variable labels, data/time info, etc. -Frank On Fri, 26 Apr 2002 08:21:10 -0700 (PDT) Thomas Lumley <tlumley at u.washington.edu> wrote:> On Fri, 26 Apr 2002, Frank E Harrell Jr wrote: > > > Try the sas.get function in the Hmisc library. Hmisc is available for > > Linux/Unix/MacOSX and will soon be updated for Windows. > > http://hesweb1.med.virginia.edu/biostat/s/Hmisc.html > > Similar functionality is available in the most recent version of the > "foreign" package as well, with read.ssd() > > -thomas > > Thomas Lumley Asst. Professor, Biostatistics > tlumley at u.washington.edu University of Washington, Seattle > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- Frank E Harrell Jr Prof. of Biostatistics & Statistics Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._