BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

Lets say I have a sas program that run long time (1 hour).

The program should run 48 times (each time with different macro arguments).

The final result of the run is update of one permanent data set (This data set is saved in a permanent libarary).

Note-Each run update the same data set and add rows to this data set (So this data set is called accumulated data set because each  run add it rows)

My question-

Is it possible that some people run the same sas program (with different macro arguments) ?

So ,multiple runs (done by multiple people) update the same data set

Is it possible?

The idea is to save run time because multiple people run in same time

 

6 REPLIES 6
SASKiwi
PROC Star

Yes this is easily doable and I do this myself a lot. If there is only one permanent SAS library affected then add the FILELOCKWAIT option to your  LIBNAME statement like so:

 

libname MyLibRef 'MyFolderPath' FILELOCKWAIT = 30;

The value you assign to FILELOCKWAIT is the number of seconds you want SAS to wait if someone else is currently updating any dataset in that library. It should be greater than the number of seconds it takes to update your shared dataset.

 

Ronein
Meteorite | Level 14

So if the program run  1 hour then what  should I write there ?? 60???

Tom
Super User Tom
Super User

@Ronein wrote:

So if the program run  1 hour then what  should I write there ?? 60???


Not the time it takes to run the program. The time it takes to update the dataset.

 

Since you said the updates are just adding observation then use PROC APPEND to keep that time as short as possible.

 

The number is in seconds, so 60 would be one minute.

 

 

SASKiwi
PROC Star

Your single dataset update step may look similar to this:

SASKiwi_0-1749429807910.png

In this example the step took a real time of 0.01 seconds. Set FILELOCKWAIT to a value in seconds greater than the real time of your update step. 

 

Patrick
Opal | Level 21

If you're using a SAS Server version then one person could also run multiple sessions. 

If you've got SAS/Connect licensed then you can spawn multiple sessions from a master SAS session - like each session with different parameter values for your macro. Or if xcmd is set then you could also generate and execute batch commands for running multiple sessions in parallel and in batch.

 

Kurt_Bremser
Super User

Why have manual program runs by multiple people in the first place?

What you describe is clearly a task for scheduled execution; this means that a single user will run the programs, and the scheduler will have control when the programs run (e.g. at nighttime when system load is low) and how many will run concurrently (avoiding deterioration of performance caused by saturation of resources).

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 643 views
  • 7 likes
  • 5 in conversation