DIY: SAS Pool Service

What if you need a SAS pool service at your server, but you don’t have a SAS/Share or SAS/Connect license? I’ve figured out from various sources and build my own pool service.
How we build
Install SAS as usual and put SAS executable’s directory to the server global path for script simplification. Create one writable shared directory (named pool_1). Create another private directory (named pool_admin) and create one batch file named pool_1_trigger.bat in the directory which contains:
     @echo off
     cls
     :start
     if not exist p:\pool_1\start.sas goto complete
     if exist p:\pool_1\processing.txt goto complete
     echo Processing… > p:\pool_1\processing.txt
     sas p:\pool_1\start.sas
     del p:\pool_1\start.sas
     del p:\pool_1\processing.txt
     :complete
     p:\pool_admin\sleep.exe 5
     goto start
Download file sleep.exe from Internet and put it in the pool_admin directory. I’ll explain why I use this program later. Register pool_1_trigger.bat in server’s Task Scheduler, set it up to run every server’s startup. Done.
How it works
pool_1_trigger.bat will start at server boot. It will stay run caused by infinite loop script (goto start). This loop will look into pool_1 directory for start.sas existence every 5 seconds (p:\pool_admin\sleep.exe 5). Create a complete SAS codes (including libname assignments etc) and save it to start.sas. When you put the file into pool_1 shared directory, it will automatically executed by pool_1_trigger.bat. Remember! because pool_1 directory is a writable shared directory, you can submit the codes from anywhere (including another web application server like Coldfusion Server!) and expect the run within 5 seconds. While executing SAS codes, the directory is flagged by processing.txt file. Any other push service can check the pool by checking this file existence.
Why I use sleep.exe
The pool_1_trigger.bat script will be less complicated if the Task Scheduler can run every second. Unfortunately the fastest loop is one minute. If you can bear wait another minute for sas execution, drop sleep.exe, modify the script, and utilize Task Scheduler.
Is it reliable?
It’s DIY! For reliability, I suggest to buy SAS/Share. But, hey, I’ve tested this method for several times and haven’t see any flaws yet.
Further enhancements
Close pool_1 sharing when start.sas exist and reopen when the process finished.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top