Re: [R] sas.get problem : the saga continues.
--- "Nordlund, Dan (DSHS/RDA)" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On > Behalf Of John Kane > > Sent: Friday, April 13, 2007 1:37 PM > > To: R R-help > > Subject: Re: [R] sas.get problem : the saga > continues. > > > > > > #Continuing my sas.get saga. Hmisc has been been > > updated however I am still > > getting the same problem. I seem to have aa SAS > > problem as well as > > an R problem. There seems to be something dodgy > in > > the SAS data or > > format files since SAS will not read the file > unless I > > use > > LIBNAME library = 'F:\testsas' > > Something like > > LIBNAME dd1 = 'F:\testsas' > > will not work and it should whereas Libname > > dd1="C:\Temp\testsas" does. > > > > However I still cannot get sas.get to read a > simple > > file which does work with > > LIBNAME dd1 = 'F:\testsas' . Can anyone see if I > am > > misreading the Help or > > making some kind of stupid typing mistake? I also > have > > tried running it on the > > C drive with no luck. Thanks > > > > Windows XP, R 2.4.1 > > > > ## EXAMPLE # > > SAS PROGRAM for simple file. ### > > libname LIBRARY 'F:\testsas'; > > proc format library= LIBRARY; > > value catfmt 1 = "Siam" > > 2 = "Persian" > > 3 = "Cougar"; > > value dogfmt 1 = "Lab" > > 2 = "Collie" > > 3 = "Coyote"; > > run; > > data library.animals; > >input cat dog; > >datalines; > > 1 3 > > 2 2 > > 3 1 > > ; > > > > Data LIBRARY.doms; > > set LIBRARY.Animals ; > > format cat catfmt. dog dogfmt.; > > proc freq; > > run; > > > > # > > # Apply sas.get > > > > library(Hmisc) > > mydata <- sas.get(library="F:/testsas", > mem="doms", > > format.library="F:/testsas", > > sasprog = '"C:/Program Files/SAS/SAS > 9.1/sas.exe"') > > > > RESULTS > > > > > library(Hmisc) > > > mydata <- sas.get(library="C:/Temp/testsas", > > mem="doms", > > + format.library="C:/Temp/testsas", > > + sasprog = '"C:/Program Files/SAS/SAS > > 9.1/sas.exe"') > > The filename, directory name, or volume label > syntax > > is incorrect. > > Error in sas.get(library = "C:/Temp/testsas", mem > = > > "doms", format.library = "C:/Temp/testsas", : > > SAS job failed with status 1 > > In addition: Warning message: > > 'cmd' execution failed with error code 1 in: > > shell(cmd, wait = TRUE, intern = output) > > John, > > You may have missed my earlier post about this. The > problem you are having with SAS is the value you are > passing in the sasprog parameter. You need to drop > the single quotes, like the following > > sasprog = "C:/Program Files/SAS/SAS 9.1/sas.exe" Ah, I'll give it a try. I added those single quotes based on an early R-list posting suggesting that the space in "Program Files" was a problem. Actually by that time I was down to superstitious learning but the idea seemed reasonable. > > sas.get() calls a function, shQuote(), which wraps > the program name in double quotes and then escapes > the double quotes you are passing, which messes up > the program name that Windows sees. Oh I see what you mean. > > I don't understand exactly what problem you are > having with the library names. If I take your code > and replace every instance of LIBRARY (in all caps) > with dd1, your program runs just fine on my WinXP > Pro system. I am not sure either but I suspect that SAS does not tollerate such new-fangled things as USB sticks. Try it on a USB and see what happens. Things seem to work just fine on a hard drive. Currently I am blaming the problem on SAS's outdated view of the world :) . Most of my SAS (as opposed to R problems) seem to disappear when I move the files to the C: drive. Something I should have thought of sooner. >If changing the sasprog parameter value > as above doesn't work, write back to the R-help with > the errors you get and someone (maybe even me :-) > should be able to help. Thanks, you have been very helpful already. Stand by for the difficult questions :) __ [EMAIL PROTECTED] 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.
Re: [R] sas.get problem : the saga continues.
--- "Nordlund, Dan (DSHS/RDA)" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On > Behalf Of John Kane > > Sent: Friday, April 13, 2007 1:37 PM > > To: R R-help > > Subject: Re: [R] sas.get problem : the saga > continues. > > > > > > #Continuing my sas.get saga. Hmisc has been been > > updated however I am still > > getting the same problem. > > John, > > I forgot to ask, where did you get the corrected > copy of Hmisc from? I checked a couple of mirrors > (WA and 2 in CA) and the Windows version of sas.get > is still broken. > > Thanks, > Not the faintest. I did a general update, noticed that Hmisc was updated and had a look at the code. Oh, wait I was using the mirror at Cran Canada(ON) which I think is the http://probability.ca/cran/ site at the University of Toronto. Unless I've misread the code it looks fixed but I may have made a mistake. __ [EMAIL PROTECTED] 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.
Re: [R] sas.get problem : the saga continues.
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of John Kane > Sent: Friday, April 13, 2007 1:37 PM > To: R R-help > Subject: Re: [R] sas.get problem : the saga continues. > > > #Continuing my sas.get saga. Hmisc has been been > updated however I am still > getting the same problem. John, I forgot to ask, where did you get the corrected copy of Hmisc from? I checked a couple of mirrors (WA and 2 in CA) and the Windows version of sas.get is still broken. Thanks, Dan Daniel J. Nordlund Research and Data Analysis Washington State Department of Social and Health Services Olympia, WA 98504-5204 __ [EMAIL PROTECTED] 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.
Re: [R] sas.get problem : the saga continues.
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of John Kane > Sent: Friday, April 13, 2007 1:37 PM > To: R R-help > Subject: Re: [R] sas.get problem : the saga continues. > > > #Continuing my sas.get saga. Hmisc has been been > updated however I am still > getting the same problem. I seem to have aa SAS > problem as well as > an R problem. There seems to be something dodgy in > the SAS data or > format files since SAS will not read the file unless I > use > LIBNAME library = 'F:\testsas' > Something like > LIBNAME dd1 = 'F:\testsas' > will not work and it should whereas Libname > dd1="C:\Temp\testsas" does. > > However I still cannot get sas.get to read a simple > file which does work with > LIBNAME dd1 = 'F:\testsas' . Can anyone see if I am > misreading the Help or > making some kind of stupid typing mistake? I also have > tried running it on the > C drive with no luck. Thanks > > Windows XP, R 2.4.1 > > ## EXAMPLE # > SAS PROGRAM for simple file. ### > libname LIBRARY 'F:\testsas'; > proc format library= LIBRARY; > value catfmt 1 = "Siam" > 2 = "Persian" > 3 = "Cougar"; > value dogfmt 1 = "Lab" > 2 = "Collie" > 3 = "Coyote"; > run; > data library.animals; >input cat dog; >datalines; > 1 3 > 2 2 > 3 1 > ; > > Data LIBRARY.doms; > set LIBRARY.Animals ; > format cat catfmt. dog dogfmt.; > proc freq; > run; > > # > # Apply sas.get > > library(Hmisc) > mydata <- sas.get(library="F:/testsas", mem="doms", > format.library="F:/testsas", > sasprog = '"C:/Program Files/SAS/SAS 9.1/sas.exe"') > > RESULTS > > > library(Hmisc) > > mydata <- sas.get(library="C:/Temp/testsas", > mem="doms", > + format.library="C:/Temp/testsas", > + sasprog = '"C:/Program Files/SAS/SAS > 9.1/sas.exe"') > The filename, directory name, or volume label syntax > is incorrect. > Error in sas.get(library = "C:/Temp/testsas", mem = > "doms", format.library = "C:/Temp/testsas", : > SAS job failed with status 1 > In addition: Warning message: > 'cmd' execution failed with error code 1 in: > shell(cmd, wait = TRUE, intern = output) John, You may have missed my earlier post about this. The problem you are having with SAS is the value you are passing in the sasprog parameter. You need to drop the single quotes, like the following sasprog = "C:/Program Files/SAS/SAS 9.1/sas.exe" sas.get() calls a function, shQuote(), which wraps the program name in double quotes and then escapes the double quotes you are passing, which messes up the program name that Windows sees. I don't understand exactly what problem you are having with the library names. If I take your code and replace every instance of LIBRARY (in all caps) with dd1, your program runs just fine on my WinXP Pro system. If changing the sasprog parameter value as above doesn't work, write back to the R-help with the errors you get and someone (maybe even me :-) should be able to help. Hope this is helpful, Dan Daniel J. Nordlund Research and Data Analysis Washington State Department of Social and Health Services Olympia, WA 98504-5204 __ [EMAIL PROTECTED] 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.
Re: [R] sas.get problem : the saga continues.
#Continuing my sas.get saga. Hmisc has been been updated however I am still getting the same problem. I seem to have aa SAS problem as well as an R problem. There seems to be something dodgy in the SAS data or format files since SAS will not read the file unless I use LIBNAME library = 'F:\testsas' Something like LIBNAME dd1 = 'F:\testsas' will not work and it should whereas Libname dd1="C:\Temp\testsas" does. However I still cannot get sas.get to read a simple file which does work with LIBNAME dd1 = 'F:\testsas' . Can anyone see if I am misreading the Help or making some kind of stupid typing mistake? I also have tried running it on the C drive with no luck. Thanks Windows XP, R 2.4.1 ## EXAMPLE # SAS PROGRAM for simple file. ### libname LIBRARY 'F:\testsas'; proc format library= LIBRARY; value catfmt 1 = "Siam" 2 = "Persian" 3 = "Cougar"; value dogfmt 1 = "Lab" 2 = "Collie" 3 = "Coyote"; run; data library.animals; input cat dog; datalines; 1 3 2 2 3 1 ; Data LIBRARY.doms; set LIBRARY.Animals ; format cat catfmt. dog dogfmt.; proc freq; run; # # Apply sas.get library(Hmisc) mydata <- sas.get(library="F:/testsas", mem="doms", format.library="F:/testsas", sasprog = '"C:/Program Files/SAS/SAS 9.1/sas.exe"') RESULTS > library(Hmisc) > mydata <- sas.get(library="C:/Temp/testsas", mem="doms", + format.library="C:/Temp/testsas", + sasprog = '"C:/Program Files/SAS/SAS 9.1/sas.exe"') The filename, directory name, or volume label syntax is incorrect. Error in sas.get(library = "C:/Temp/testsas", mem = "doms", format.library = "C:/Temp/testsas", : SAS job failed with status 1 In addition: Warning message: 'cmd' execution failed with error code 1 in: shell(cmd, wait = TRUE, intern = output) __ [EMAIL PROTECTED] 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.
Re: [R] sas.get problem
Cancel this! . I see that Hmisc is already changed. When I updated today it was changed. My thanks to Mr Dupont the maintainer. I still have a problem with sas.get but that's another post. --- John Kane <[EMAIL PROTECTED]> wrote: > > --- Tim Churches <[EMAIL PROTECTED]> wrote: > > > 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))) > > > > > Just how would I go about making this change in the > code or where would I look? > > Thanks > > > > > > 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 > > > > > > __ > [EMAIL PROTECTED] 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. > __ [EMAIL PROTECTED] 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.
Re: [R] sas.get problem
--- Tim Churches <[EMAIL PROTECTED]> wrote: > 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))) > Just how would I go about making this change in the code or where would I look? Thanks > 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 > > __ [EMAIL PROTECTED] 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.
Re: [R] sas.get problem
--- Frank E Harrell Jr <[EMAIL PROTECTED]> wrote: > John Kane wrote: > > --- [EMAIL PROTECTED] wrote: > >> John, > >> > >> I believe the format file must have a .sc or > >> .sas7bcat file extension (not > >> .sas7bdat which is a sas dataset extension). I > >> think that's why you're > >> getting the error F:/sas/formats.sc? or > >> formats.sas7bcat not found. > > > > Current state of play: > > Files : SAS 9.x > > > > formea1.sas7bdat > > formea2.sas7bdat > > formats.sas7bcat > > > > I notice that the formats.sas7bcat is drastically > > different from the sas.bdat > > icons. > > > > We seem to be making some progress even if the > data > > file still has not loaded. > > > > In the ammended sas.get condition I get an error > > object ".R." not found. > > I hope this is not an Hmisc object. > > It is. You need library(Hmisc) in effect before > using sas.get. > > The system output error will be fixed in an upcoming > release of Hmisc. > > Frank > Just as I feared! Oh well I can still do the SAS > SPSS > R routine or use Marc's suggetion to export a csv file. Thanks for the confirmation. I strongly suspected that .R. was Hmisc. > > > > Thanks > > > > > > Run with Hmisc > > > > mydata <- sas.get(library="F:/sas", mem="formea1", > > format.library="F:/sas", > > sasprog = '"C:Program Files/SAS/SAS > 9.1/sas.exe"') > > > > Error in sas.get(library = "F:/sas", mem = > "formea1", > > format.library = "F:/sas", : > > SAS job failed with status -1 > > In addition: Warning message: > > "\"C:Program not found > > > > > > Run with modified sas.get (Hmisc not loaded) > > > > Error in sas.get(library = "F:/sas", mem = > "formea1", > > format.library = "F:/sas", : > > object ".R." not found > > > > > > > > > > > > > >> Also, is the carriage return after '"C:/Program > in > >> the code below caused > >> by copying and pasting into the email or is the > code > >> that way in your > >> program? > >> > >> Regards, > >> -Cody > >> > >> > >> > >> > > >> > >> John Kane > > >> > >> <[EMAIL PROTECTED] > > >> > >> ca> > > >>To > >> Sent by: > >> [EMAIL PROTECTED] > >> [EMAIL PROTECTED] > > >>cc > >> at.math.ethz.ch R R-help > >> > >> > > >> Subject > >>Re: [R] > >> sas.get problem > >> 04/11/2007 07:41 > > >> > >> AM > > >> > >> > > >> > >> > > >> > >> > > >> > >> > > >> > >> > >> > >> > >> > >> > >> --- Tim Churches <[EMAIL PROTECTED]> wrote: > >> > >>> 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 using R2.4.1 under Windows XP > >>>> SAS files were created with SAS 9.x > >>>
Re: [R] sas.get problem
John Kane wrote: > --- [EMAIL PROTECTED] wrote: >> John, >> >> I believe the format file must have a .sc or >> .sas7bcat file extension (not >> .sas7bdat which is a sas dataset extension). I >> think that's why you're >> getting the error F:/sas/formats.sc? or >> formats.sas7bcat not found. > > Current state of play: > Files : SAS 9.x > > formea1.sas7bdat > formea2.sas7bdat > formats.sas7bcat > > I notice that the formats.sas7bcat is drastically > different from the sas.bdat > icons. > > We seem to be making some progress even if the data > file still has not loaded. > > In the ammended sas.get condition I get an error > object ".R." not found. > I hope this is not an Hmisc object. It is. You need library(Hmisc) in effect before using sas.get. The system output error will be fixed in an upcoming release of Hmisc. Frank > > Thanks > > > Run with Hmisc > > mydata <- sas.get(library="F:/sas", mem="formea1", > format.library="F:/sas", > sasprog = '"C:Program Files/SAS/SAS 9.1/sas.exe"') > > Error in sas.get(library = "F:/sas", mem = "formea1", > format.library = "F:/sas", : > SAS job failed with status -1 > In addition: Warning message: > "\"C:Program not found > > > Run with modified sas.get (Hmisc not loaded) > > Error in sas.get(library = "F:/sas", mem = "formea1", > format.library = "F:/sas", : > object ".R." not found > > > > > > >> Also, is the carriage return after '"C:/Program in >> the code below caused >> by copying and pasting into the email or is the code >> that way in your >> program? >> >> Regards, >> -Cody >> >> >> >> >> >> John Kane >> >> <[EMAIL PROTECTED] >> >> ca> >>To >> Sent by: >> [EMAIL PROTECTED] >> [EMAIL PROTECTED] >>cc >> at.math.ethz.ch R R-help >> >> >> Subject >>Re: [R] >> sas.get problem >> 04/11/2007 07:41 >> >> AM >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> --- Tim Churches <[EMAIL PROTECTED]> wrote: >> >>> 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 using R2.4.1 under Windows XP >>>> SAS files were created with SAS 9.x >>>> They convert easily into SPSS 14 >>>> 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 >
Re: [R] sas.get problem
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of John Kane > Sent: Wednesday, April 11, 2007 11:30 AM > To: [EMAIL PROTECTED] > Cc: R R-help > Subject: Re: [R] sas.get problem > > <<>> > > Current state of play: > Files : SAS 9.x > > formea1.sas7bdat > formea2.sas7bdat > formats.sas7bcat > > I notice that the formats.sas7bcat is drastically > different from the sas.bdat > icons. > > We seem to be making some progress even if the data > file still has not loaded. > > In the ammended sas.get condition I get an error > object ".R." not found. > I hope this is not an Hmisc object. > > Thanks > > > Run with Hmisc > > mydata <- sas.get(library="F:/sas", mem="formea1", > format.library="F:/sas", > sasprog = '"C:Program Files/SAS/SAS 9.1/sas.exe"') > > Error in sas.get(library = "F:/sas", mem = "formea1", > format.library = "F:/sas", : > SAS job failed with status -1 > In addition: Warning message: > "\"C:Program not found > The warning here is due to wrapping the sasprog argument in single and double quotes. Sometimes you need to do this in R when trying to run a command using system() under Windows. However, sas.get() uses the function shQuote() to wrap Windows system calls in double quotes and escapes any internal double quotes with "\". You can see the escape character in the warning message above. If you remove the single quotes the warning should disappear. > > Run with modified sas.get (Hmisc not loaded) > > Error in sas.get(library = "F:/sas", mem = "formea1", > format.library = "F:/sas", : > object ".R." not found > Actually, you should load Hmisc using library(Hmisc) and then source in your corrected sas.get() function. Then execute the following call mydata <- sas.get(library="F:/sas", mem="formea1", format.library="F:/sas", sasprog = "C:/Program Files/SAS/SAS 9.1/sas.exe") #no single quotes This assuming that your sas dataset and formats.sas7bcat are in F:\SAS and the SAS executable is in the specified directory on the c: drive of the machine you are running this on. Hope this is helpful, Dan Daniel J. Nordlund Research and Data Analysis Washington State Department of Social and Health Services Olympia, WA 98504-5204 __ 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.
Re: [R] sas.get problem
John Kane wrote: > How do I make this change? I naively have tried by > a) list sas.get and copy to editor > b) reload R without loading Hmisc > c) made recommended changes to sas.get > d) stuck a "sas.get <- " in front of the function and > ran it. Here is what I do, until Frank fixes the problem in the Hmisc package itself: a) list sas.get and copy to editor b) make the change to line 127 as described c) preface the function with "sas.get <- " d) save that as "sas_get_fixed.R" e) reload R and load Hmisc f) source("sas_get_fixed.R") The final step will mask the original, broken sas.get function with the fixed version. Tim C __ 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.
Re: [R] sas.get problem
--- Marc Schwartz <[EMAIL PROTECTED]> wrote: > On Wed, 2007-04-11 at 14:38 -0400, John Kane wrote: > > --- [EMAIL PROTECTED] wrote: > > > > > > > > John, > > > > > > Do you not have sas on your machine? (That would > > > definitely keep sas.get > > > from executing.) > > > > > > Regards, > > >-Cody > > > > No I don't have SAS on my machine. Nobody in my > group > > uses it and we seldom use SPSS. I think one person > has > > STATA. Most of the work is more policy than data > work > > and the occasional spreadsheet (shudder) does for > > basic work. > > > > I am too cheap to have us spend a huge amount > (well, > > large amount anyway) for something that I am > likely > > to use for 5-10 minutes a year. The last time I > wanted > > a SPSS file exported to "delimited" I just asked > > someone in another department whom I knew has it > on > > his labtop to do it. > > > > I just hike across campus to the nearest lab with > SAS, > > SPSS etc installed. Done occasionally and in > decent > > weather it is not a problem. Today it is turning > into > > a marathon but I need to lose some weight. > > > > John, I believe that this has been mentioned on the > list previously, but > if you don't have convenient access to SAS, they do > offer a free > download called the SAS System Viewer. It can read > the proprietary SAS > datasets and then enable you to save them as ASCII > delimited files. Thanks Marc. I had seen a reference to that and lost it. I'll get a copy. However the major purpose of using sas.get is/was to keep the value labels and variable labels. For the number of times in a year that I need SAS , the 5 minute walk to the nearest lab with SAS etc is not a problem. At the moment I will probably have to resort to the SAS > SPSS > R route. A pain but not that bad. At the moment I am finding it easier to import the SAS file into SPSS than to load it in SAS. > > It is available at the SAS web site here: > > http://www.sas.com/apps/demosdownloads/sassystemviewer_PROD_9.1.3_sysdep.jsp?packageID=000313 > > There is also DBMS/Copy, which is by DataFlux (now a > SAS subsidiary). > More information is here: > > http://www.dataflux.com/Technology/Products/DBMS/ > > HTH, > > Marc Schwartz > > > __ 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.
Re: [R] sas.get problem
On Wed, 2007-04-11 at 14:38 -0400, John Kane wrote: > --- [EMAIL PROTECTED] wrote: > > > > > John, > > > > Do you not have sas on your machine? (That would > > definitely keep sas.get > > from executing.) > > > > Regards, > >-Cody > > No I don't have SAS on my machine. Nobody in my group > uses it and we seldom use SPSS. I think one person has > STATA. Most of the work is more policy than data work > and the occasional spreadsheet (shudder) does for > basic work. > > I am too cheap to have us spend a huge amount (well, > large amount anyway) for something that I am likely > to use for 5-10 minutes a year. The last time I wanted > a SPSS file exported to "delimited" I just asked > someone in another department whom I knew has it on > his labtop to do it. > > I just hike across campus to the nearest lab with SAS, > SPSS etc installed. Done occasionally and in decent > weather it is not a problem. Today it is turning into > a marathon but I need to lose some weight. John, I believe that this has been mentioned on the list previously, but if you don't have convenient access to SAS, they do offer a free download called the SAS System Viewer. It can read the proprietary SAS datasets and then enable you to save them as ASCII delimited files. It is available at the SAS web site here: http://www.sas.com/apps/demosdownloads/sassystemviewer_PROD_9.1.3_sysdep.jsp?packageID=000313 There is also DBMS/Copy, which is by DataFlux (now a SAS subsidiary). More information is here: http://www.dataflux.com/Technology/Products/DBMS/ HTH, Marc Schwartz __ 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.
Re: [R] sas.get problem
--- [EMAIL PROTECTED] wrote: > > John, > > Do you not have sas on your machine? (That would > definitely keep sas.get > from executing.) > > Regards, >-Cody No I don't have SAS on my machine. Nobody in my group uses it and we seldom use SPSS. I think one person has STATA. Most of the work is more policy than data work and the occasional spreadsheet (shudder) does for basic work. I am too cheap to have us spend a huge amount (well, large amount anyway) for something that I am likely to use for 5-10 minutes a year. The last time I wanted a SPSS file exported to "delimited" I just asked someone in another department whom I knew has it on his labtop to do it. I just hike across campus to the nearest lab with SAS, SPSS etc installed. Done occasionally and in decent weather it is not a problem. Today it is turning into a marathon but I need to lose some weight. > > John Kane > > <[EMAIL PROTECTED] > > ca> >To > > [EMAIL PROTECTED] > 04/11/2007 10:56 >cc > AMR R-help > > > Subject >Re: [R] > sas.get problem > > > > > > > > > > > > > > > > > > --- [EMAIL PROTECTED] wrote: > > > > > John, > > > > I believe the format file must have a .sc or > > .sas7bcat file extension (not > > .sas7bdat which is a sas dataset extension). I > > think that's why you're > > getting the error F:/sas/formats.sc? or > > formats.sas7bcat not found. > > I looked at that about 4 times and did not see it. > Thanks. That is probably the major problem I am > having getting the files to load in SAS. I knew it > was > a format problem but since the format worked with > SPSS > I didn't think of that. > > > > > > Also, is the carriage return after '"C:/Program > in > > the code below caused > > by copying and pasting into the email or is the > code > > that way in your > > program? > > That's a Cut & Paste problem but thanks for catching > it. > > Well time to finish lunch and hike back to the > computer lab. I'm beginning to regret being to > cheap > to ask for an SAS licence :( > > I may get this running today after all. I really > don't want to do a SAS > SPSS > R route. It is a > bit > too much like a Rube Goldbeg cartoon. > > Thanks > > > > > Regards, > > -Cody > > > > > > > > > > > > John Kane > > > > <[EMAIL PROTECTED] > > > > ca> > >To > > Sent by: > > [EMAIL PROTECTED] > > [EMAIL PROTECTED] > >cc > > at.math.ethz.ch R R-help > > > > > > Subject > >Re: [R] > > sas.get problem > > 04/11/2007 07:41 > > > > AM > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --- Tim Churches <[EMAIL PROTECTED]> wrote: > > > > > 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 using R2.4.1 under Windows XP > > > > SAS files were created with SAS 9.x > > > > They convert easily into SPSS 14 > > > > > > Exampl
Re: [R] sas.get problem
--- [EMAIL PROTECTED] wrote: > > John, > > I believe the format file must have a .sc or > .sas7bcat file extension (not > .sas7bdat which is a sas dataset extension). I > think that's why you're > getting the error F:/sas/formats.sc? or > formats.sas7bcat not found. Current state of play: Files : SAS 9.x formea1.sas7bdat formea2.sas7bdat formats.sas7bcat I notice that the formats.sas7bcat is drastically different from the sas.bdat icons. We seem to be making some progress even if the data file still has not loaded. In the ammended sas.get condition I get an error object ".R." not found. I hope this is not an Hmisc object. Thanks Run with Hmisc mydata <- sas.get(library="F:/sas", mem="formea1", format.library="F:/sas", sasprog = '"C:Program Files/SAS/SAS 9.1/sas.exe"') Error in sas.get(library = "F:/sas", mem = "formea1", format.library = "F:/sas", : SAS job failed with status -1 In addition: Warning message: "\"C:Program not found Run with modified sas.get (Hmisc not loaded) Error in sas.get(library = "F:/sas", mem = "formea1", format.library = "F:/sas", : object ".R." not found > > Also, is the carriage return after '"C:/Program in > the code below caused > by copying and pasting into the email or is the code > that way in your > program? > > Regards, > -Cody > > > > > > John Kane > > <[EMAIL PROTECTED] > > ca> >To > Sent by: > [EMAIL PROTECTED] > [EMAIL PROTECTED] >cc > at.math.ethz.ch R R-help > > > Subject >Re: [R] > sas.get problem > 04/11/2007 07:41 > > AM > > > > > > > > > > > > > > > --- Tim Churches <[EMAIL PROTECTED]> wrote: > > > 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 using R2.4.1 under Windows XP > > > SAS files were created with SAS 9.x > > > They convert easily into SPSS 14 > > > > 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) > >
Re: [R] sas.get problem
John, Do you not have sas on your machine? (That would definitely keep sas.get from executing.) Regards, -Cody John Kane <[EMAIL PROTECTED] ca>To [EMAIL PROTECTED] 04/11/2007 10:56 cc AMR R-help Subject Re: [R] sas.get problem --- [EMAIL PROTECTED] wrote: > > John, > > I believe the format file must have a .sc or > .sas7bcat file extension (not > .sas7bdat which is a sas dataset extension). I > think that's why you're > getting the error F:/sas/formats.sc? or > formats.sas7bcat not found. I looked at that about 4 times and did not see it. Thanks. That is probably the major problem I am having getting the files to load in SAS. I knew it was a format problem but since the format worked with SPSS I didn't think of that. > > Also, is the carriage return after '"C:/Program in > the code below caused > by copying and pasting into the email or is the code > that way in your > program? That's a Cut & Paste problem but thanks for catching it. Well time to finish lunch and hike back to the computer lab. I'm beginning to regret being to cheap to ask for an SAS licence :( I may get this running today after all. I really don't want to do a SAS > SPSS > R route. It is a bit too much like a Rube Goldbeg cartoon. Thanks > > Regards, > -Cody > > > > > > John Kane > > <[EMAIL PROTECTED] > > ca> >To > Sent by: > [EMAIL PROTECTED] > [EMAIL PROTECTED] > cc > at.math.ethz.ch R R-help > > > Subject >Re: [R] > sas.get problem > 04/11/2007 07:41 > > AM > > > > > > > > > > > > > > > --- Tim Churches <[EMAIL PROTECTED]> wrote: > > > 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 using R2.4.1 under Windows XP > > > SAS files were created with SAS 9.x > > > They convert easily into SPSS 14 > > > > 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", > &
Re: [R] sas.get problem
--- [EMAIL PROTECTED] wrote: > > John, > > I believe the format file must have a .sc or > .sas7bcat file extension (not > .sas7bdat which is a sas dataset extension). I > think that's why you're > getting the error F:/sas/formats.sc? or > formats.sas7bcat not found. I looked at that about 4 times and did not see it. Thanks. That is probably the major problem I am having getting the files to load in SAS. I knew it was a format problem but since the format worked with SPSS I didn't think of that. > > Also, is the carriage return after '"C:/Program in > the code below caused > by copying and pasting into the email or is the code > that way in your > program? That's a Cut & Paste problem but thanks for catching it. Well time to finish lunch and hike back to the computer lab. I'm beginning to regret being to cheap to ask for an SAS licence :( I may get this running today after all. I really don't want to do a SAS > SPSS > R route. It is a bit too much like a Rube Goldbeg cartoon. Thanks > > Regards, > -Cody > > > > > > John Kane > > <[EMAIL PROTECTED] > > ca> >To > Sent by: > [EMAIL PROTECTED] > [EMAIL PROTECTED] >cc > at.math.ethz.ch R R-help > > > Subject >Re: [R] > sas.get problem > 04/11/2007 07:41 > > AM > > > > > > > > > > > > > > > --- Tim Churches <[EMAIL PROTECTED]> wrote: > > > 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 using R2.4.1 under Windows XP > > > SAS files were created with SAS 9.x > > > They convert easily into SPSS 14 > > > > 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))) > > > > Tim C > > Thanks Tim, > > How do I make this change? I naively have tried by > a) list sas.get and copy to editor > b) reload R without loading Hmisc > c) made recommended changes to sas.get > d) stuck a "s
Re: [R] sas.get problem
John, I believe the format file must have a .sc or .sas7bcat file extension (not .sas7bdat which is a sas dataset extension). I think that's why you're getting the error F:/sas/formats.sc? or formats.sas7bcat not found. Also, is the carriage return after '"C:/Program in the code below caused by copying and pasting into the email or is the code that way in your program? Regards, -Cody John Kane <[EMAIL PROTECTED] ca>To Sent by: [EMAIL PROTECTED] [EMAIL PROTECTED] cc at.math.ethz.ch R R-help Subject Re: [R] sas.get problem 04/11/2007 07:41 AM --- Tim Churches <[EMAIL PROTECTED]> wrote: > 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 using R2.4.1 under Windows XP > > SAS files were created with SAS 9.x > > They convert easily into SPSS 14 > > 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))) > > Tim C Thanks Tim, How do I make this change? I naively have tried by a) list sas.get and copy to editor b) reload R without loading Hmisc c) made recommended changes to sas.get d) stuck a "sas.get <- " in front of the function and ran it. R returns the same error messages. I have also corrected the typo in sasprog and done some renaming following Cody's suggestions. Currently I have: formea1.sas7bdat formea2.sas7bdat formats.sas7bdat detach("package:Hmisc") mydata <- sas.get(library="F:/sas", mem="formea1", format.library="F:/sas", sasprog = '"C:/Program Files/SAS/SAS9.1/sas.exe"') RESULTS Error in sas.get(library = "F:/sas", mem = "formea1", format.library = "F:/sas", : SAS job failed with status -1 In addition: Warning messages: 1: F:/sas/formats.sc? or formats.sas7bcat not found. Formatting ignored. in: sas.get(library = "F:/sas", mem = "formea1", format.library = "F:/sas", 2: "\"C:/Program not found - I really don't see why the sagprog does not work unless an early error is falling through. Thanks for all the help __ 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. __ 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.
Re: [R] sas.get problem
--- Tim Churches <[EMAIL PROTECTED]> wrote: > 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 using R2.4.1 under Windows XP > > SAS files were created with SAS 9.x > > They convert easily into SPSS 14 > > 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))) > > Tim C Thanks Tim, How do I make this change? I naively have tried by a) list sas.get and copy to editor b) reload R without loading Hmisc c) made recommended changes to sas.get d) stuck a "sas.get <- " in front of the function and ran it. R returns the same error messages. I have also corrected the typo in sasprog and done some renaming following Cody's suggestions. Currently I have: formea1.sas7bdat formea2.sas7bdat formats.sas7bdat detach("package:Hmisc") mydata <- sas.get(library="F:/sas", mem="formea1", format.library="F:/sas", sasprog = '"C:/Program Files/SAS/SAS9.1/sas.exe"') RESULTS Error in sas.get(library = "F:/sas", mem = "formea1", format.library = "F:/sas", : SAS job failed with status -1 In addition: Warning messages: 1: F:/sas/formats.sc? or formats.sas7bcat not found. Formatting ignored. in: sas.get(library = "F:/sas", mem = "formea1", format.library = "F:/sas", 2: "\"C:/Program not found - I really don't see why the sagprog does not work unless an early error is falling through. Thanks for all the help __ 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.
Re: [R] sas.get problem
--- [EMAIL PROTECTED] wrote: > > 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). Ah yes. I think I had it in one attempt and then decided I had misread the documentation. > Also, do you need a forward slash after C: in the >sasprog option below? Yes. It was correct in the orginal program but I got a typo then sticking it in the posting. I have corrected it. Thanks 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? Just tried it. I had originally renamed them from form_ea1 etc because I did not trust the " _ " . I was a bit too groggy yesterday to understand the warning about the format file . I now have it renamed 'format.sas7dbat' which R, or SAS, is telling me cannot be found. So far I have cleaned up all of this with no luck. Now, on to Tim's hack! Thanks for all the help. > 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@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@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.
Re: [R] sas.get problem
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 __ 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.
Re: [R] sas.get problem
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 __ 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.
Re: [R] sas.get problem
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 <[EMAIL PROTECTED] ca>To Sent by: R R-help [EMAIL PROTECTED] 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@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@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.
Re: [R] sas.get problem
On Wed, 2003-10-01 at 13:43, Marc Schwartz wrote: > On Wed, 2003-10-01 at 13:23, Duncan Murdoch wrote: > > On Wed, 01 Oct 2003 14:02:15 -0400, "Peter Flom" <[EMAIL PROTECTED]> wrote > > : > > > > >When I try > > > > > > citypro <- sas.get('c:/ndri/cvar/data', member = 'citypro2') > > > > > > > > >I get the following errors and warnings: > > > > > > > > >'sas' is not recognized as an internal or external command, > > >operable program or batch file. > > > > That's an S-PLUS function rather than an R function, isn't it? Does > > some R package supply sas.get? > > > > I believe the S-PLUS implementation requires that you have SAS > > installed, and it looks like the error message is saying that you > > don't. But if you're using S-PLUS, you'd be better asking on the > > s-news mailing list. > > > > Duncan Murdoch > > > Duncan, > > sas.get() is in Frank Harrell's Hmisc package on CRAN (recently > available there) for R. > > I would defer to Frank's comments here, but reading the .PDF file that > is on CRAN, it does confirm that one must be able to run SAS in order to > use sas.get(): > > "Note > > You must be able to run SAS (by typing sas) on your system. If the S > command !sas does not start SAS, then this function cannot work." > > HTH, > > Marc Schwartz A quick follow up. I installed Frank's Hmisc under R 1.8.0 beta. If Hmisc is not attached (ie. library(Hmisc)), you get: > citypro <- sas.get('c:/ndri/cvar/data', member = 'citypro2') Error: couldn't find function "sas.get" which you would reasonably expect. Thus, it seems more likely that Dr. Flom either does not have SAS on his system or perhaps the SAS executable file (sas.exe? IIRC) is not in Dr. Flom's 'PATH' on his system if SAS is installed. HTH, Marc __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sas.get problem
Thanks to all who responded Marc Schwartz wrote < A quick follow up. I installed Frank's Hmisc under R 1.8.0 beta. If Hmisc is not attached (ie. library(Hmisc)), you get: > citypro <- sas.get('c:/ndri/cvar/data', member = 'citypro2') Error: couldn't find function "sas.get" which you would reasonably expect. Thus, it seems more likely that Dr. Flom either does not have SAS on his system or perhaps the SAS executable file (sas.exe? IIRC) is not in Dr. Flom's 'PATH' on his system if SAS is installed. >>> This does seem to be the problem Thanks again Peter __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sas.get problem
It's actually in the Hmisc package. The error looks like Hmisc hasn't been attached yet, so you might try library(Hmisc) first. In addition, it does appear from the help file that you need SAS installed to output the ASCII files that are required to import the data. HTH, Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 >>> Duncan Murdoch <[EMAIL PROTECTED]> 10/01/03 02:23PM >>> On Wed, 01 Oct 2003 14:02:15 -0400, "Peter Flom" <[EMAIL PROTECTED]> wrote : >When I try > > citypro <- sas.get('c:/ndri/cvar/data', member = 'citypro2') > > >I get the following errors and warnings: > > >'sas' is not recognized as an internal or external command, >operable program or batch file. That's an S-PLUS function rather than an R function, isn't it? Does some R package supply sas.get? I believe the S-PLUS implementation requires that you have SAS installed, and it looks like the error message is saying that you don't. But if you're using S-PLUS, you'd be better asking on the s-news mailing list. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sas.get problem
On Wed, 2003-10-01 at 13:23, Duncan Murdoch wrote: > On Wed, 01 Oct 2003 14:02:15 -0400, "Peter Flom" <[EMAIL PROTECTED]> wrote > : > > >When I try > > > > citypro <- sas.get('c:/ndri/cvar/data', member = 'citypro2') > > > > > >I get the following errors and warnings: > > > > > >'sas' is not recognized as an internal or external command, > >operable program or batch file. > > That's an S-PLUS function rather than an R function, isn't it? Does > some R package supply sas.get? > > I believe the S-PLUS implementation requires that you have SAS > installed, and it looks like the error message is saying that you > don't. But if you're using S-PLUS, you'd be better asking on the > s-news mailing list. > > Duncan Murdoch Duncan, sas.get() is in Frank Harrell's Hmisc package on CRAN (recently available there) for R. I would defer to Frank's comments here, but reading the .PDF file that is on CRAN, it does confirm that one must be able to run SAS in order to use sas.get(): "Note You must be able to run SAS (by typing sas) on your system. If the S command !sas does not start SAS, then this function cannot work." HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sas.get problem
On Wed, 01 Oct 2003 14:02:15 -0400, "Peter Flom" <[EMAIL PROTECTED]> wrote : >When I try > > citypro <- sas.get('c:/ndri/cvar/data', member = 'citypro2') > > >I get the following errors and warnings: > > >'sas' is not recognized as an internal or external command, >operable program or batch file. That's an S-PLUS function rather than an R function, isn't it? Does some R package supply sas.get? I believe the S-PLUS implementation requires that you have SAS installed, and it looks like the error message is saying that you don't. But if you're using S-PLUS, you'd be better asking on the s-news mailing list. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help