SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Ramiro_iese
Calcite | Level 5

Is it possible to run a %do loop (in a macro) ussing parallel processing? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

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.

View solution in original post

6 REPLIES 6
ballardw
Super User

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.

Ramiro_iese
Calcite | Level 5

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

 

yabwon
Onyx | Level 15

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

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



SASKiwi
PROC Star

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.

LinusH
Tourmaline | Level 20

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

Data never sleeps
yabwon
Onyx | Level 15

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

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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