I have 3 SAS files all in the directory F:/sas, two data files and a format file : form.ea1.sas7bdat form.ea2.sas7bdat sas.fmts.sas7bdat F is a USB. I am trying import them to R using "sas.get". I have not used SAS since I was downloading data from mainframe and having to write JCL. I had forgotten how bizarre SAS can be. I currently have not even figured out how to load the files into SAS but they look fine since I can import them with no problem into SPSS. I am using R2.4.1 under Windows XP SAS files were created with SAS 9.x They convert easily into SPSS 14 I n the example below I have tried various versions of the file names with with no luck. Can anyone suggest some approach(s) that I might take. Example. library(Hmisc) mydata <- sas.get(library="F:/sas", mem="form.ea1", format.library="sas.fmts.sas7bdat", sasprog = '"C:Program Files/SAS/SAS 9.1/sas.exe"') Error message (one of several that I have gotten while trying various things.) The filename, directory name, or volume label syntax is incorrect. Error in sas.get(library = "F:/sas", mem = "form.ea1", format.library = "sas.fmts.sas7bdat", : SAS job failed with status 1 In addition: Warning messages: 1: sas.fmts.sas7bdat/formats.sc? or formats.sas7bcat not found. Formatting ignored. in: sas.get(library = "F:/sas", mem = "form.ea1", format.library = "sas.fmts.sas7bdat", 2: 'cmd' execution failed with error code 1 in: shell(cmd, wait = TRUE, intern = output)
John, According to the sas.get documentation, the format library option must specify the directory containing the file formats.sct (I don't think it can be a sas dataset). Also, do you need a forward slash after C: in the sasprog option below? Finally, sas may not like the period in the file name form.ea1 (it will read 'form' as the libname) - can you rename the file? Regards, -Cody John Kane <jrkrideau at yahoo. ca> To Sent by: R R-help <r-help at stat.math.ethz.ch> r-help-bounces at st cc at.math.ethz.ch Subject [R] sas.get problem 04/10/2007 03:02 PM I have 3 SAS files all in the directory F:/sas, two data files and a format file : form.ea1.sas7bdat form.ea2.sas7bdat sas.fmts.sas7bdat F is a USB. I am trying import them to R using "sas.get". I have not used SAS since I was downloading data from mainframe and having to write JCL. I had forgotten how bizarre SAS can be. I currently have not even figured out how to load the files into SAS but they look fine since I can import them with no problem into SPSS. I am using R2.4.1 under Windows XP SAS files were created with SAS 9.x They convert easily into SPSS 14 I n the example below I have tried various versions of the file names with with no luck. Can anyone suggest some approach(s) that I might take. Example. library(Hmisc) mydata <- sas.get(library="F:/sas", mem="form.ea1", format.library="sas.fmts.sas7bdat", sasprog = '"C:Program Files/SAS/SAS 9.1/sas.exe"') Error message (one of several that I have gotten while trying various things.) The filename, directory name, or volume label syntax is incorrect. Error in sas.get(library = "F:/sas", mem = "form.ea1", format.library = "sas.fmts.sas7bdat", : SAS job failed with status 1 In addition: Warning messages: 1: sas.fmts.sas7bdat/formats.sc? or formats.sas7bcat not found. Formatting ignored. in: sas.get(library = "F:/sas", mem = "form.ea1", format.library = "sas.fmts.sas7bdat", 2: 'cmd' execution failed with error code 1 in: shell(cmd, wait = TRUE, intern = output) ______________________________________________ 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.
John Kane wrote:> I have 3 SAS files all in the directory F:/sas, two > data files > and a format file : > form.ea1.sas7bdat > form.ea2.sas7bdat > sas.fmts.sas7bdat > > F is a USB. > > I am trying import them to R using "sas.get". > > I have not used SAS since I was downloading data from > mainframe > and having to write JCL. I had forgotten how bizarre > SAS can be. > I currently have not even figured out how to load the > files into SAS but > they look fine since I can import them with no problem > into SPSS. > > I am using R2.4.1 under Windows XP > SAS files were created with SAS 9.x > They convert easily into SPSS 14 > > I > n the example below I have tried various versions of > the file names with > with no luck. > Can anyone suggest some approach(s) that I might take. > > Example. > > library(Hmisc) > mydata <- sas.get(library="F:/sas", mem="form.ea1", > format.library="sas.fmts.sas7bdat", > sasprog = '"C:Program Files/SAS/SAS > 9.1/sas.exe"') > > Error message (one of several that I have gotten > while trying various things.) > The filename, directory name, or volume label syntax > is incorrect. > Error in sas.get(library = "F:/sas", mem = "form.ea1", > format.library = "sas.fmts.sas7bdat", : > SAS job failed with status 1 > In addition: Warning messages: > 1: sas.fmts.sas7bdat/formats.sc? or formats.sas7bcat > not found. Formatting ignored. > in: sas.get(library = "F:/sas", mem = "form.ea1", > format.library = "sas.fmts.sas7bdat", > 2: 'cmd' execution failed with error code 1 in: > shell(cmd, wait = TRUE, intern = output)The sas.get function in the Hmisc library is broken under Windows. Change line 127 from: status <- sys(paste(shQuote(sasprog), shQuote(sasin), "-log", shQuote(log.file)), output = FALSE) to: status <- system(paste(shQuote(sasprog), shQuote(sasin), "-log", shQuote(log.file))) I found this fix in the R-help archives, sorry, don't have the original to hand so I can't give proper attribution, but the fix is not due to me. But it does work for me. I believe Frank Harrell has been notified of the problem and the fix. Once patched and working correctly, the sas.get function in the Hmisc library is fantastic - thanks Frank! Tim C
John Kane wrote:> I have 3 SAS files all in the directory F:/sas, two > data files > and a format file : > form.ea1.sas7bdat > form.ea2.sas7bdat > sas.fmts.sas7bdat > > F is a USB. > > I am trying import them to R using "sas.get". > > I have not used SAS since I was downloading data from > mainframe > and having to write JCL. I had forgotten how bizarre > SAS can be. > I currently have not even figured out how to load the > files into SAS but > they look fine since I can import them with no problem > into SPSS. > > I am using R2.4.1 under Windows XP > SAS files were created with SAS 9.x > They convert easily into SPSS 14 > > I > n the example below I have tried various versions of > the file names with > with no luck. > Can anyone suggest some approach(s) that I might take. > > Example. > > library(Hmisc) > mydata <- sas.get(library="F:/sas", mem="form.ea1", > format.library="sas.fmts.sas7bdat", > sasprog = '"C:Program Files/SAS/SAS > 9.1/sas.exe"') > > Error message (one of several that I have gotten > while trying various things.) > The filename, directory name, or volume label syntax > is incorrect. > Error in sas.get(library = "F:/sas", mem = "form.ea1", > format.library = "sas.fmts.sas7bdat", : > SAS job failed with status 1 > In addition: Warning messages: > 1: sas.fmts.sas7bdat/formats.sc? or formats.sas7bcat > not found. Formatting ignored. > in: sas.get(library = "F:/sas", mem = "form.ea1", > format.library = "sas.fmts.sas7bdat", > 2: 'cmd' execution failed with error code 1 in: > shell(cmd, wait = TRUE, intern = output) >also line sasprog = '"C:Program Files/SAS/SAS9.1/sas.exe" should be sasprog = '"C:/Program Files/SAS/SAS9.1/sas.exe" -- Charles Dupont Computer System Analyst School of Medicine Department of Biostatistics Vanderbilt University