Is it possible to run a %do loop (in a macro) ussing parallel processing?
Parallel processing in SAS usually means you run multiple SAS jobs at the same time, each in a separate SAS session. If you are running the same logic in each job, you need to split your input data so each SAS job does a different slice of data.
Typically you only parallel process to speed up slow run times. There is no point in doing it if your run times are acceptable. For example, I have a parallelised job that took around 14 hours to run sequentially, but now takes less than 4 hours, split into 4 parallel jobs all running at the same time.
This could well depend on what you mean by parallel processing.
Can you provide a description or details of what you are wanting to do.
I am new in SAS, but I am used to code in Julia.
There exist a library called "Threads". Then, for example, if you have a for loop from 1 to 12 and your computer has 4 cores, these process divides the computation between them and then it merges the results and shows it as it were calculated one by one
BASE SAS is single threaded (in general) with some exceptions (like sorting with Proc Sort or Proc DS2's threads). There is no dedicated library/package for parallel processing.
If you have SAS Viya (with CAS engine) you can have "parallel" data step processing.
Bart
Parallel processing in SAS usually means you run multiple SAS jobs at the same time, each in a separate SAS session. If you are running the same logic in each job, you need to split your input data so each SAS job does a different slice of data.
Typically you only parallel process to speed up slow run times. There is no point in doing it if your run times are acceptable. For example, I have a parallelised job that took around 14 hours to run sequentially, but now takes less than 4 hours, split into 4 parallel jobs all running at the same time.
There's a concept called MP Connect (requires a SAS/CONNECT license).
In short you can spawn several child SAS sessions from a master SAS session.
One benefit is you can relatively easily orchestrate this using SAS code (e.g. do%), so you don't have to rely on OS functionality.
https://support.sas.com/rnd/scalability/connect/mp.html
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/connref/p1sszj6a6otsy2n1pnseg8vh98l8.htm
If you want to do a "parallel macro execution" in BASE SAS look up this tutorial:
https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/Parallel-processing-in-BASE-SAS.sas
Bart
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.