Monday, June 23, 2014

Change the process priority in SAS

This SAS code programmatically changes the process priority for the current SAS program. You may want to use this for SAS batch jobs.

For example, when I run multiprocessor jobs using Ian J. Ghent %multiThreadDataStep macro, the Windows user interface becomes less responsive and my batch job competes with other processes, but using this method addresses both issues.

Simply run the line corresponding to the desired priority level. To decrease process priority, choose one of the last two.

x "wmic.exe process where processid=""&SYSJOBID"" call setpriority 'high priority'";
x "wmic.exe process where processid=""&SYSJOBID"" call setpriority 'above normal'";
x "wmic.exe process where processid=""&SYSJOBID"" call setpriority 'normal'";
x "wmic.exe process where processid=""&SYSJOBID"" call setpriority 'below normal'";
x "wmic.exe process where processid=""&SYSJOBID"" call setpriority 'idle'";

Tested on SAS 9.4 on Windows 7 and SAS 9.3 on Windows 2008.

I don't have SAS for Linux, but I guess it would look like this to increase the niceness and therefore reduce the process priority:

x "renice -p 16 &SYSJOBID";

No comments:

Post a Comment

Snowflake SQL error: NULL result in a non-nullable column

Troubleshooting Snowflake SQL Error : NULL result in a non-nullable column When working with Snowflake, you might encounter the error mes...