BookmarkSubscribeRSS Feed
vietlinh12hoa
Obsidian | Level 7

I have a SAS table with 100 million rows, it's not efficient to export under csv format. Any chance sas can convert the table into sqlite3 (python) to be opened in Python?

 

 

6 REPLIES 6
Kurt_Bremser
Super User

I don't think that SAS provides a module for that particular format.

But you can compress the csv on the fly to reduce space:

filename class zip "/folders/myfolders/class.zip";

data _null_;
set sashelp.class;
file class(class.csv) dlm="," dsd;
if _n_ = 1 then put "name,sex,age,height,weight";
put name sex age height weight;
run;

filename class clear;

You will need to unpack it on the target server before reading it into the database.

Patrick
Opal | Level 21

Googling using    site:documentation.sas.com sqlite     returns a few hits. Not sure if any will be helpful to you but suggest you find out for yourself.

Sajid01
Meteorite | Level 14

SQLITE supports odbc . You can download the driver from http://www.ch-werner.de/sqliteodbc/ .
The documentation is here http://www.ch-werner.de/sqliteodbc/html/index.html .
Please do update if  it has worked for you so that others may benefit.

AlanC
Barite | Level 11

libname sqlite odbc complete="dsn=SQLite3 Datasource;Driver={SQLITE3 ODBC Driver};Database=e:\temp\IISHistoricalSample.db";

libname temp 'e:\temp' ;

 

data sqlite.Sample;

   set temp.All_iis_new (obs=100);

run;

https://github.com/savian-net
AlanC
Barite | Level 11
Also, Sqlite is not related to Python. It is a nice system because it is a single file database. For SAS data, if I recall correctly, I get an enormous savings in space vs a SAS dataset. It has its issues such as minimal typing (ex. no datetime).
https://github.com/savian-net
SASKiwi
PROC Star

You'll need SAS's SAS/ACCESS to ODBC product for @AlanC 's approach.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2503 views
  • 4 likes
  • 6 in conversation