'UNSW - Science

UNSW - Science - HPC

SAS

The 64-bit version of SAS 9.4 available on the Katana cluster. As with all software on the clusters you will need to load SAS using the module command either manually or in by adding it to your .bashrc before running it.

By default SAS will store temporary files in /tmp which can easily fill up leaving the node offline. In order to avoid this we have told SAS to use $TMPDIR to save temporary files in /var/tmp on the Katana head node and local scratch on compute nodes. If you wish to save temporary files to a different location you can do that by either adding -work /my/directory to your SAS command and it will automatically put the files in the correct location or adding the line

-work /my/directory

to your sasv9.cfg file.

If you have made a ssh connection to the cluster from Linux or a system that supports X Windows then you can open a graphical SAS session using the following commands. Note: You can only run a graphical session if you have started an interactive job.

qsub -I
module add sas
 
sas

Most (if not all) of the time that you use SAS you should use it in "line mode" which can be called by adding the -nodms flag to your SAS command. For example if you wish to start SAS interactively you can type the following.

qsub -I
module add sas
 
sas -nodms

If you have a SAS program called program.sas then you can open the program in SAS by using the command sas program.sas. In an interactive session (which is a good way of confirming that your SAS program will work when called by a job script) you would type the following. Note: Loading a program in SAS or sending input to SAS causes SAS to automatically use line mode so you don't need to use the -nodms option.

qsub -I
module add sas
 
sas program.sas

If you want to send input into the SAS program you can pipe it to the SAS command in the following way.

cat myinput.txt | sas program.sas

Finally if you wish to pass parameters to your SAS script you should add "-sysparm 'A B C'" after to your SAS command where A, B and C are parameters.

If you run any SAS program by using sas program.sas then by default SAS will leave a 'myprog.lst' and a
'myprog.log' file in the directory that you ran SAS from containing logs and results from the running pf the program.

Some examples of job scripts that call SAS programs are shown lower in the page.

SAS PBS Examples

Whilst you are working on making sure that your SAS code works on the cluster, the module command is being loaded correctly and you are referring to the right location for files you may want to use the following line to request a short term interactive terminal.

z1234567@kc01b02:~$ qsub -I -l nodes=1:ppn=1,vmem=8gb,walltime=1:00:00

and once you have a terminal you can run

z1234567@kc01b02:~$ module add sas
z1234567@kc01b02:~$ sas -nodms

To run a SAS program that you prepared earlier in your interactive terminal you type the following.

z1234567@kc01b02:~$ module add sas
z1234567@kc01b02:~$ sas program.sas

To use any of the following job scripts on Katana save the job script as myjob.pbs and then submit it by typing

qsub myjob.pbs

The following Katana PBS script requests 1 CPU core with a maximum of 4Gb of memory for a job that runs for up to 12 hours. This job script uses the module command to load the SAS application when the job script is run.

#!/bin/bash
 
#PBS -N MySASprog
#PBS -l nodes=1:ppn=1
#PBS -l vmem=4gb
#PBS -l walltime=12:00:00
#PBS -j oe
 
cd $PBS_O_WORKDIR
 
module add sas
 
sas program.sas 

In the next example we have added the module command to the .bashrc to simplify the job script and are also making use of an input file.

#!/bin/bash
 
#PBS -N MySASprog
#PBS -l nodes=1:ppn=1
#PBS -l vmem=4gb
#PBS -l walltime=12:00:00
#PBS -j oe
 
cd $PBS_O_WORKDIR
 
cat myinput.txt | sas program.sas 

If you want to make use of local scratch for better performance then you can use prologue and epilogue scripts to copy files to and from local scratch. For more details look at the Local Scratch page.

#!/bin/bash
 
#PBS -N SCRATCH
#PBS -l nodes=1:ppn=1
#PBS -l vmem=6gb
#PBS -l walltime=4:00:00
#PBS -l file=50gb
#PBS -j oe
 
#PBS -l prologue=/srv/scratch/z1234567/prologue
#PBS -l epilogue=/srv/scratch/z1234567/epilogue
 
cd $PBS_O_WORKDIR
 
sas program.sas