DATA Step, Macro, Functions and more

DIY: SAS Pool Service

New Contributor
Posts: 2

DIY: SAS Pool Service

Hi! This is my first post & want to share my latest SAS DIY... :smileygrin: What do you think?

What if you need a SAS pool service at your server, but you don't have 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
      if not exist p:\pool_1\ goto complete
      if exist p:\pool_1\processing.txt goto complete
      echo Processing... > p:\pool_1\processing.txt
      sas p:\pool_1\
      del p:\pool_1\
      del p:\pool_1\processing.txt
      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 existence every 5 seconds (p:\pool_admin\sleep.exe 5). Create a complete SAS codes (including libname assignments etc) and save it to 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/Connect. But, hey, I've tested this method for several times and haven't see any flaws yet.

Further enhancements
Close pool_1 sharing when exist and reopen when the process finished.

Additional note

  • Repost from my blog.
  • I'm using it to integrate Adobe Coldfusion Server with SAS, so any CF scripts can throw any SAS codes to this pool & wait for the result.
Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation