[R] sas.get problem
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Thu Apr 12 00:32:59 CEST 2007
John Kane wrote:
> --- Cody_Hamilton at Edwards.com 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
>>
>> <jrkrideau at yahoo.
>>
>> ca>
>> To
>> Sent by:
>> tchur at optusnet.com.au
>> r-help-bounces at st
>> cc
>> at.math.ethz.ch R R-help
>> <r-help at stat.math.ethz.ch>
>>
>> Subject
>> Re: [R]
>> sas.get problem
>> 04/11/2007 07:41
>>
>> AM
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --- Tim Churches <tchur at optushome.com.au> 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 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.
>>
>>
>>
>>
>>
>
> ______________________________________________
> 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.
>
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list