Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert sas7bdat file to csv?

I want to convert a .sas7bdat file to a .csv/txt format so that I can upload it into a hive table. I'm receiving the .sas7bdat file from an outside server and do not have SAS on my machine.

like image 809
Ashpreet Bedi Avatar asked Oct 23 '14 16:10

Ashpreet Bedi


2 Answers

I recently wrote this package that allows you convert sas7bdat to csv using Hadoop/Spark. It's able to split giant sas7bdat file thus achieving high parallelism. The parsing also uses parso as suggested by @Ashpreet

https://github.com/saurfang/spark-sas7bdat

like image 62
Saurfang Avatar answered Sep 22 '22 09:09

Saurfang


The python package sas7bdat, available here, includes a library for reading sas7bdat files:

from sas7bdat import SAS7BDAT
with SAS7BDAT('foo.sas7bdat') as f:
    for row in f:
        print row

and a command-line program requiring no programming

$ sas7bdat_to_csv in.sas7bdat out.csv
like image 39
Andrew Avatar answered Sep 22 '22 09:09

Andrew