SAS Batch Job Example

Sample SAS input script ‘t-test.sas’:

* load the dataset;
data pulse;
 input pre post;
datalines;
 62 61
 63 62
 58 59
 64 61
 64 63
 61 58
 68 61
 66 64
 65 62
 67 68
 69 65
 61 67
 64 65
 61 63
 63 62
;

* it is always a good idea to print out the dataset;
proc print;
run;

* perform the analysis using PROC TTEST;
proc ttest;
  paired pre*post; * tells sas to compute the test for the paired differences;
run;

Sample SLURM script ‘sas.submit’ to submit the SAS job above:

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --mem=1gb
#SBATCH --time=00:10:00
#SBATCH --job-name=sas_example
#SBATCH --error=sas_example.%J.err
#SBATCH --output=sas_example.%J.out

module load SAS/9.4

sas t-test.sas

Submit this job using sbatch:

[jzhan61@clogin01 sas]$ sbatch sas.submit 
Submitted batch job 20824

Results:

[jzhan61@clogin01 sas]$ ls -l
total 120K
-rw-r--r-- 1 jzhan61 hpcusers  376 Nov  3 03:26 t-test.sas
-rwxr-xr-x 1 jzhan61 hpcusers  239 Nov  3 03:28 sas.submit
-rw-r--r-- 1 jzhan61 hpcusers    0 Nov  3 03:28 sas_example.20824.out
-rw-r--r-- 1 jzhan61 hpcusers    0 Nov  3 03:28 sas_example.20824.err
-rw-r--r-- 1 jzhan61 hpcusers 2.9K Nov  3 03:28 t-test.log
-rw-r--r-- 1 jzhan61 hpcusers 2.2K Nov  3 03:28 t-test.lst