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
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.
So if the program run 1 hour then what should I write there ?? 60???
@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.
Your single dataset update step may look similar to this:
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.
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.
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).
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.
Ready to level-up your skills? Choose your own adventure.