r/SQL • u/AdEnvironmental7198 • 18d 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
View all comments
Show parent comment
2
u/Dangerous_Cup3607 17d ago edited 17d ago
No links just experience.
If you use a libname connection to oracle and proc sql to pull the data, the disadvantage of it is a slower method, but the advantage of that is you can use SAS native syntax like datepart , year(sales_date), intck, intnx, today()-1 etc; and also join the data to some SAS table like the targeted customer list.
If you use an Oracle passthru wrapper code, then it is a faster pull but you will need to use oracle sql syntax like trunc, extract (year from sales_date), sysdate-1.
16 Gb is not a lot but it can still be a good 20 min pull and returning may be 10 million rows of raw data.
But eventually you would transform the data into meaningful output summaries like the monthly counts and rates, by groups and categories. Then proc export the raw data into an Excel template (have defined pivot tables and charts, and color coding), and only replace the raw data.
Then use the file system to trigger email and attach the file send to yourself. Once you open the new excel file in email the pivot table and charts can be configured to refresh upon opening.
So just use SAS oracle passthru and obtain the required data and fields into a SAS temp table. Then transform the data within SAS tables instead, your final output then can be stored in a SAS libname folder. So that you dont have to pull from Oracle resource again and again.
Ie
query1 just passthru pulling customer list
query2 just passthru pulling product list
query3 just passthru pulling transactions
join the 3 SAS temp tables based on whats needed to create your final dataset and store in SAS libname path.