r/SQL • • 23d ago

Oracle SQL with SAS

Is it the norm to have a program that is coded in SAS and then need SQL to store the the data? The need SQL tools to pull information about out the tables then swap back to SAS to pull lots of data out quickly? New analyst at a new job and it is exhausting

4 Upvotes

20 comments sorted by

View all comments

1

u/lucky555_me 23d ago

Yes, totally normal, especially in banks, insurance, pharma and healthcare. Oracle (or another database) is where the data lives, and SAS is where the analysis happens. It feels clunky at first, but you can make it a lot less exhausting.

The big tip: let Oracle do the heavy lifting before the data reaches SAS. Most of the pain comes from pulling huge raw tables into SAS and filtering them there.

  1. Point SAS straight at Oracle with a LIBNAME, so you can use the tables without switching tools:

libname ora oracle path=yourdb schema=yourschema;

2. For big pulls, use explicit pass-through. The query inside the parentheses runs entirely in Oracle, and only the result comes back to SAS:

proc sql;

connect to oracle (path=yourdb);

create table work.summary as

select * from connection to oracle (

select region, count(*) as orders, sum(amount) as total

from sales

where sale_date >= date '2026-01-01'

group by region

);

disconnect from oracle;

quit;

Filtering and summarising in the database and bringing back thousands of rows instead of millions is usually the difference between waiting minutes and waiting seconds.

3. Ask your team if they already have shared macros or saved connection setups. Most SAS shops do, and nobody tells the new person.

It gets much smoother once you're writing the SQL part in pass-through and only doing the stats in SAS.