Re: [R] Read SAS data

2010-03-26 Thread Nicola Sturaro Sommacal
On Thu, Mar 25, 2010 at 19:32, Nordlund, Dan (DSHS/RDA) nord...@dshs.wa.gov
 wrote:


 Here is one work-around for sas.get on MS Windows platforms.

 http://finzi.psych.upenn.edu/Rhelp10/2008-December/182573.html


Hi and thank you very much!

I try solutions #2 and #3 and I found that last one works.

Thank you.

--
Nicola Sturaro Sommacal
Quantide srl

http://www.quantide.com

[[alternative HTML version deleted]]

__
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.


Re: [R] Read SAS data

2010-03-25 Thread Nordlund, Dan (DSHS/RDA)
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
 Behalf Of Nicola Sturaro Sommacal
 Sent: Thursday, March 25, 2010 9:16 AM
 To: r-help@r-project.org
 Subject: [R] Read SAS data
 
 Hi!
 
 I need to import in R some SAS dataset (sas7bdat). I found two functions to
 do it:
 read.ssd from the package foreign and sas.get from Hmisc.
 
 df = read.ssd(libname = path2data, sectionnames = sasSmallDataset,
 tmpXport = path2data, tmpProgLoc = path2data, sascmd = path2sas)
 sas.get(libraryName = path2data, member = sasSmallDataset, formats =
 FALSE, sasprog = path2sas, keep.log = TRUE)
 
 where path2data is the directory on which is contained the file sas,
 sasSmallDataset.sas7bdat are the data and path2sas is the path to SAS
 (C:/Programmi/SAS/SAS System/9.0/sas.exe).
 
 I obtain the following messages:
 
 from read.ssd:
 SAS failed.  SAS program at Z:/projects/QUANTIDE/import2R/.sas
 The log file will be import2R.log in the current directory
 Warning messages:
 1: In file.symlink(oldPath, linkPath) :
   symlinks are not supported on this platform
 2: In read.ssd(libname = path2data, sectionnames = sasSmallDataset,  :
   SAS return code was 2
 
 from sas.get:
 Error in if (status != 0) { : argument is of length zero
 
 I have SAS 9.0 and R 2.10.1 running on Windows XP Pro.
 
 Can you help me to found a solution or can you provide an alternative way to
 import SAS data directly from R?
 
 Thank you very much.
 
 --
  Nicola Sturaro Sommacal
 Quantide srl
 
 http://www.quantide.com

Here is one work-around for sas.get on MS Windows platforms.

http://finzi.psych.upenn.edu/Rhelp10/2008-December/182573.html

Here is another thread that you might find useful.

http://tolstoy.newcastle.edu.au/R/e9/help/10/02/6248.html

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204

__
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.


Re: [R] Read SAS data

2010-03-25 Thread Mike Reese
Nicola,

I found its easier if you  convert your SAS data to the XPORT format (a SAS 
transport format).  Here's instructions for creating the transport file in SAS 
- use xport not cport.

http://support.sas.com/documentation/cdl/en/movefile/59598/HTML/default/a002575816.htm

I also found the import works better in R if you use the sasxport.get (instead 
of read.xport) function. I believe this function is part of the Hmisc library). 
 

BTW I'm looking for help with the write.dta command, specifically, exporting 
dataframes with variable labels that are readable in  STATA.  Do you know 
anything about that?

Mike

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Nordlund, Dan (DSHS/RDA)
Sent: Thursday, March 25, 2010 2:32 PM
To: Nicola Sturaro Sommacal; r-help@r-project.org
Subject: Re: [R] Read SAS data

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
 Behalf Of Nicola Sturaro Sommacal
 Sent: Thursday, March 25, 2010 9:16 AM
 To: r-help@r-project.org
 Subject: [R] Read SAS data
 
 Hi!
 
 I need to import in R some SAS dataset (sas7bdat). I found two functions to
 do it:
 read.ssd from the package foreign and sas.get from Hmisc.
 
 df = read.ssd(libname = path2data, sectionnames = sasSmallDataset,
 tmpXport = path2data, tmpProgLoc = path2data, sascmd = path2sas)
 sas.get(libraryName = path2data, member = sasSmallDataset, formats =
 FALSE, sasprog = path2sas, keep.log = TRUE)
 
 where path2data is the directory on which is contained the file sas,
 sasSmallDataset.sas7bdat are the data and path2sas is the path to SAS
 (C:/Programmi/SAS/SAS System/9.0/sas.exe).
 
 I obtain the following messages:
 
 from read.ssd:
 SAS failed.  SAS program at Z:/projects/QUANTIDE/import2R/.sas
 The log file will be import2R.log in the current directory
 Warning messages:
 1: In file.symlink(oldPath, linkPath) :
   symlinks are not supported on this platform
 2: In read.ssd(libname = path2data, sectionnames = sasSmallDataset,  :
   SAS return code was 2
 
 from sas.get:
 Error in if (status != 0) { : argument is of length zero
 
 I have SAS 9.0 and R 2.10.1 running on Windows XP Pro.
 
 Can you help me to found a solution or can you provide an alternative way to
 import SAS data directly from R?
 
 Thank you very much.
 
 --
  Nicola Sturaro Sommacal
 Quantide srl
 
 http://www.quantide.com

Here is one work-around for sas.get on MS Windows platforms.

http://finzi.psych.upenn.edu/Rhelp10/2008-December/182573.html

Here is another thread that you might find useful.

http://tolstoy.newcastle.edu.au/R/e9/help/10/02/6248.html

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204

__
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.

__
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.


Re: [R] read sas data into R

2007-10-09 Thread Peter Dalgaard
Mary Royerr wrote:
 Hi

 I am having trouble using read.ssd. Can someone help?

 The code that I have written is

 *sashome-C:/Mary/Datasets*
 *read.ssd(read.ssd(file.path(sashome, core, sashelp), surv_1v,*
 *sascmd = file.path(sashome, sas.exe))*

 Here the path that I have given is correct, where the dataset
 surv_1v.sas7bdat is kept. The message that R gives me is this:

 *SAS failed.  SAS program at
 C:\DOCUME~1\Royerm02\LOCALS~1\Temp\Rtmpdi2Osb\file4ff053f7.sas
 The log file will be file4ff053f7.log in the current directory
 NULL
 Warning messages:
 1: C:/Mary/Datasets /sas.exe not found in: system(paste(sascmd, tmpProg))
 2: SAS return code was -1 in: read.ssd(file.path(C:/Mary/Datasets,
   
 *
 what do I do? The help for read.ssd does not help either. So any help will
 be greatly appreciated.

   
You need to get sascmd to contain the full path to your SAS 
executable.  Currently, it is not finding it in C:/Mary/Datasets 
/sas.exe (what's up with the extra space?). More likely it is somewhere 
under C:/Program Files/


-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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.