How to read in a large sas7bdat dataset in R?

I have a 60gb sas7bdat file that I am trying to multiply in R. Does anyone know a method for this?

I have SAS and it takes about 14 minutes to complete, but I want to do it in R.

Thank you

+4
source share
2 answers

See my answer here -

I found that the package havenworks fast enough when reading files sas7bdat.

In any case, at 60 GB, it’s best to convert it to, .csvor something freadcan handle, and then data.table::freadto R.

+2
source

dsread http://www.oview.co.uk/dsread/, Sas csv.

CMD, R. , Sas csv:

esp_Sas_Csv<-function(dir,file_input,dir_output,device="c:") {
p1<-paste("cd",dir)
if(tolower(device)!="c:") {p1<-paste(device,"\n",p1)}

#"open" the program

p2<-"SET dsread=C:\\dsread\\dsread.exe"
cmd2<-paste('"%dsread%" /v /t ',file_input,' >  "',dir_output,file_input,'.csv"',sep="")

cmd<-paste(p1,p2,cmd2, sep="\n")
setwd("c:\\temp")
write(cmd,"sas_to_csv.bat")
system("sas_to_csv.bat")

}

:

device<-"c:"
dir<-"C:\\temp\\"
file_input<-"my_sas_tab"
dir_output<-"C:\\temp\\"

esp_Sas_Csv(dir,file_input,dir_output,device)

a .bat

cd C:\temp\
SET dsread=C:\dsread\dsread.exe
"%dsread%" /v /t my_sas_tab >  "C:\temp\my_sas_tab.csv"
+1

Source: https://habr.com/ru/post/1530348/


All Articles