[R] Problems importing Unix SAS .ssd04 file to R (Win)

johannes rara johannesraja at gmail.com
Tue Oct 20 19:58:19 CEST 2009


Thanks Daniel for your response. Actually I haven't tried that yet,
cause I'm not so fluent with SAS. I got this file from a colleague. I
was thinking that R can read these files, but maybe the problem is
with SAS.

-Johannes



C can you read that dataset just using your Windows SAS v8?

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

2009/10/20 johannes rara <johannesraja at gmail.com>:
> Hello,
>
> I'm trying to import a SAS file made using SAS on Unix. Currently I'm
> using SAS on Windows and I'm trying to import that .ssd04 file to R.
> The file name of the file is testfile.ssd04 and it is located in
> 'M:\sasuser'. I'm using Windows XP and R 2.91. Basically what I'm
> doing is
>
> ############ r code ##############
>> library(foreign)
>> sashome <- "C:/Program Files/SAS Institute/SAS/V8"
>> folder_for_datafiles <- "M:/sasuser"
>> read.ssd(folder_for_datafiles, "testfile", sascmd=file.path(sashome, "sas.exe"))
>
> SAS failed.  SAS program at
> C:\DOCUME~1\jrara\LOCALS~1\Temp\RtmpAAxO3X\file41bb5af1.sas
> The log file will be file41bb5af1.log in the current directory
> NULL
> Warning message:
> In read.ssd(folder_for_datafiles, "testfile", sascmd = file.path(sashome,  :
>  SAS return code was 2
>>
> ##################################
>
> This temporary SAS file 'file41bb5af1.sas' looks like this
>
> ############ sas code #############
> option validvarname = v6;libname src2rd 'M:/sasuser';
> libname rd xport 'C:\DOCUME~1\jrara\LOCALS~1\Temp\RtmpAAxO3X\file6df11649';
> proc copy in=src2rd out=rd;
> select testfile ;
> ##################################
>
> Any ideas what I'm doing wrong?
>
>
>> sessionInfo()
> R version 2.9.1 (2009-06-26)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=Finnish_Finland.1252;LC_CTYPE=Finnish_Finland.1252;LC_MONETARY=Finnish_Finland.1252;LC_NUMERIC=C;LC_TIME=Finnish_Finland.1252
>
> attached base packages:
> [1] graphics  grDevices utils     datasets  grid      stats
> methods   base
>
> other attached packages:
> [1] foreign_0.8-38 gregmisc_2.1.1 gplots_2.7.1   caTools_1.9
> bitops_1.0-4.1 gtools_2.6.1   gmodels_2.15.0 gdata_2.6.1
>
> loaded via a namespace (and not attached):
> [1] MASS_7.2-49
>>
>




More information about the R-help mailing list