Module SAS
Contents |
|---|
Interactive job
Open an interactive session to a compute node. Adjust the number of CPUs (--cpus-per-task 1) and the amount of memory (--mem 4G) needed for your job. Increase the number of --cpus-per-task only when using code that can run in parallel.
srun --cpus-per-task 1 --mem 4G --pty bash
Load SAS module.
module load sas/9.4
Run SAS in interactive line mode.
sas -nodms
[user@athena1 ~]$ srun --cpus-per-task 1 --mem 4G --pty bash
[user@athena101 ~]$ module load sas/9.4
[user@athena101 ~]$ sas nodms
NOTE: SAS (r) Proprietary Software 9.4 (TS1M8)
Licensed to VIRGINIA COMMONWEALTH UNIVERSITY - SFA T&R, Site 70090310.
NOTE: This session is executing on the Linux 5.14.0-362.8.1.el9_3.x86_64 (LIN
X64) platform.
NOTE: Analytical products:
SAS/STAT 15.3
SAS/ETS 15.3
SAS/OR 15.3
SAS/IML 15.3
SAS/QC 15.3
NOTE: Additional host information:
Linux LIN X64 5.14.0-362.8.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 8
17:36:32 UTC 2023 x86_64 Rocky Linux release 9.3 (Blue Onyx)
You are running SAS 9. Some SAS 8 files will be automatically converted
by the V9 engine; others are incompatible. Please see
http://support.sas.com/rnd/migration/planning/platform/64bit.html
PROC MIGRATE will preserve current SAS file attributes and is
recommended for converting all your SAS libraries from any
SAS 8 release to SAS 9. For details and examples, please see
http://support.sas.com/rnd/migration/index.html
This message is contained in the SAS news file, and is presented upon
initialization. Edit the file "news" in the "misc/base" directory to
display site-specific news and information in the program log.
The command line option "-nonews" will prevent this display.
NOTE: SAS initialization used:
real time 0.09 seconds
cpu time 0.04 seconds
1?
Exit the session using the command endsas;
Batch job
Create the SAS script file.
SAS_script.sas
proc ds2 libs=work;
data _null_;
/* init() - system method */
method init();
declare varchar(16) message; /* method (local) scope */
message = 'Hello World!';
put message;
end;
enddata;
run;
quit;
Create the Slurm script file. Adjust the number of CPUs (--cpus-per-task 1) and the amount of memory (--mem 4G) needed for your job. Increase the number of --cpus-per-task only when using code that can run in parallel.
SAS_slurm_script.sh
#!/bin/bash
#SBATCH --job-name SAS_job
#SBATCH --output SAS_job_output.log
#SBATCH --error SAS_job_error.log
#SBATCH --cpus-per-task 1
#SBATCH --mem 4G
module load sas/9.4
sas SAS_script.sas
Submit the job to Slurm.
sbatch SAS_slurm_script.shMonitor the execution of your job in the Slurm queue.
squeue -u $USERThe job may show up in the queue as running (R) or pending (PD). When the job completes, it will disappear from the queue and you can check the output.
[user@athena1 ~]$ sbatch SAS_slurm_script.sh
Submitted batch job 123
[user@athena1 ~]$ squeue -u $USER
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) ## Job is running with JOBID 123
123 cpu SAS_job user R 0:01 1 athena101
[user@athena1 ~]$ squeue -u $USER
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) ## JOBID 123 completed and exited the queue
[user@athena1 ~]$ cat SAS_script.log
1 The SAS System 08:47 Friday, December 22, 2023
NOTE: Copyright (c) 2023 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M8)
Licensed to VIRGINIA COMMONWEALTH UNIVERSITY - SFA T&R, Site 70090310.
NOTE: This session is executing on the Linux 5.14.0-362.8.1.el9_3.x86_64 (LIN X64) platform.
[...]
NOTE: SAS initialization used:
real time 0.12 seconds
cpu time 0.03 seconds
1 proc ds2 libs=work;
2 data _null_;
3
4 /* init() - system method */
5 method init();
6 declare varchar(16) message; /* method (local) scope */
7 message = 'Hello World!';
8 put message;
9 end;
10 enddata;
11 run;
Hello World!
NOTE: Execution succeeded. No rows affected.
12 quit;
NOTE: PROCEDURE DS2 used (Total process time):
2 The SAS System 08:47 Friday, December 22, 2023
[...]
SAS via Open OnDemand
SAS can be run on the cluster using Open OnDemand. Go to https://athena3.hprc.vcu.edu and select the SAS app.
Configure the requirements for your job (CPUs and memory). Increase the number of CPUs only when using code that can run in parallel. Select the GPU partition and a number of GPUs only when using code that can run on the GPU.
The job will be queued waiting for resources.
When the job starts running you will be able to connect to SAS.
SAS will open on a new tab.
When you finish working with SAS please close the session by clicking on the red "Delete" button on the Open OnDemand tab.