BookmarkSubscribeRSS Feed
Adhiwardhana
Calcite | Level 5

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
      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/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 start.sas 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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 735 views
  • 0 likes
  • 1 in conversation