BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
EtoUspeh
Fluorite | Level 6

Hi, everyone!

 

Oracle databases have an option to create compressed tables:

    create table new_table compress as

    select *

    from old_table

 

I can create uncompressed Oracle tables from SAS:

    libname lib_orcl oracle user=orcl_user path=orcl_srv password=orcl_password schema=orcl_user;

    proc sql;

        create table lib_orcl.new_table as

        select *

        from old_SAS_table;

    quit;

 

Is there a way to make compressed Oracle tables from within SAS?

 

option compress=yes; doesn't seem to work

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Have not tested this, but on the LIBNAME statement you have the option DBCREATE_TABLE_OPTS=. with this option you can specify options to be used when creating a table in Oracle.

 

The SASTRACE option below will show the SQL passed to the DBMS.

 

Code sample could look like this:

libname sugus oracle path=xe  DBCREATE_TABLE_OPTS="compress";

options
  sastrace=",,,d"
  sastraceloc=saslog
  nostsuffix
;

proc delete data=sugus.comp_test;
run;

data sugus.comp_test;
  set sashelp.cars;
run;

View solution in original post

5 REPLIES 5
ybolduc
Quartz | Level 8

Have you tried using an explicit pass-through? Usually, this is the best way to use Database specific functionnalities.

 

See this URL: http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a003113595.htm

 

Thanks,

EtoUspeh
Fluorite | Level 6

The issue with pass-through is that as far as I know does not allow to use data on SAS server.

 

I need to take some data from SAS server and put it into Oracle...

ybolduc
Quartz | Level 8

You could create the table with an explicit pass-through and the use a simple proc sql insert statement to populate it.

BrunoMueller
SAS Super FREQ

Have not tested this, but on the LIBNAME statement you have the option DBCREATE_TABLE_OPTS=. with this option you can specify options to be used when creating a table in Oracle.

 

The SASTRACE option below will show the SQL passed to the DBMS.

 

Code sample could look like this:

libname sugus oracle path=xe  DBCREATE_TABLE_OPTS="compress";

options
  sastrace=",,,d"
  sastraceloc=saslog
  nostsuffix
;

proc delete data=sugus.comp_test;
run;

data sugus.comp_test;
  set sashelp.cars;
run;
EtoUspeh
Fluorite | Level 6

Thanks, Bruno! This is exactly what I need.

 

The "create and insert" solution would probably work too but it's just inconvenient.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 2807 views
  • 0 likes
  • 3 in conversation