I would like to consult expertise of the community regarding my plan if it would be feasible.
(1) Load file to SAS
(2) Call python/R to do some treatments on the SAS dataset
(3) Load SAS dataset to RDBMS
If everything is on a sas script, will SAS be able to capture if there are any failures in the pyhton script called?
NOTE: Reason there's a python/R as there were previously built scripts to cleanse the data. While it can be done in SAS thru prxmatch,etc we don't want too waste much effort replacing a working one in python/R
Greatly appreciate your inputs and thoughts on this.
Thank you!
not sure about python integration, but you can run R code in proc IML.
An introduction is given here:
https://www.youtube.com/watch?v=rUaTTre24kI
Where does the data for step (1) come from? Do you read from the RDBMS, or from external data?
My preferred method to communicate with other applications is to use a common file format and store the data there.
So I'd try to
(after the data is in SAS)
- write data to a file format suitable for the external application
- run the external application from SAS (XCMD necessary), and catch the return code (suitable wrapper script for external app necessary)
- if RC = 0, read the output back into SAS and transform for loading into the RDBMS
You don't need additional SAS licensing, and the blueprint works for any application that can be run from the commandline.
Thanks I have the same thing in mind in case they push for this approach. But I'm planning to have all the processing done in python as I don't have to let SAS read back and forth data in the dbms
I am not seeing the value - load to SAS, run Python, upload to DBMS? Why not just use Python to load, check and upload to DBMS, or if you are moving to SAS, put the time in to do the migration. Surely any time you spend maintaining multiple applications will mitigate migration costs (just thinking about validation of installs, updates, etc.).
Agree with you on this one as I was also trying to point out to the team that it's either go for python doing the processing and loading of file to dbms. Because loading back and forth to dbms using SAS will be time consuming
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.