SAS on Wharton’s HPC3
SAS is available in Wharton’s HPC environment in several ways, both interactively and via batch job submission.
WRDS Libraries on Wharton’s HPC3
To enable your SAS jobs to see all of the WRDS Libraries in Wharton’s HPC environment, create an autoexec.sas file in your home directory, with the following code:
%include '/wrds/lib/utility/wrdslib.sas';
Or you can copy the file to your home directory from the SAS demo directory, like:
cp /usr/local/demo/SAS/autoexec.sas ~
You can also pick and choose the libname statements you like from the /wrds/lib/utility/wrdslib.sas file, and place them in your autoexec.sas file, or simply in your code. This can save time when starting.
NOTE: you will need to restart SAS, or log off and back on to SAS Studio, to enable this after setup.
Submitting Batch SAS Jobs
Create SAS Commands File
Create a .sas file with your commands, for example myjob.sas
:
proc iml; a={1 2 3 }; run; print a; run; endsas;
Create SAS Job Script
Create a .sh file (myjob.sh
) with at least the following contents:
#!/bin/bash #$ -N sasjob01 #$ -j y #$ -m e sas -nodms -noterminal your-commands-file.sas
Submit SAS Job
qsub myjob.sh
More information: HPC3 Job Management
Interactive SAS Sessions
- Graphical (NEW! Recommended!! Note: requires VPN connection when off-campus): SAS Studio @ https://hpc3-sas.wharton.upenn.edu/
- Graphical: PC SAS/Connect. See the section below for more information.
- Graphical (requires X Forwarding): qrsh sas
- Textual: qrsh sas -nodms
SAS Studio
SAS Studio is a web interface development and research environment for SAS!
Connect to Wharton’s SAS Studio @ https://hpc3-sas.wharton.upenn.edu/ from on campus, or from off campus with the Wharton VPN installed and connected.
SAS says:
SAS Studio is a developmental web application for SAS that you access through your web browser. With SAS Studio, you can access your data files, libraries, and existing programs, and you can write new programs. You can also use the predefined tasks in SAS Studio to generate SAS code for you. When you run a program or task, SAS Studio processes the SAS code on a SAS server. The SAS server can be a server in a cloud environment, a server in your local environment, or SAS installed on your local machine. After the code is processed, the results are returned to SAS Studio in your browser. You can also use SAS ODS Graphics Designer and SAS ODS Graphics Editor in SAS Studio.
SAS Studio Documentation & further reading
PC SAS/CONNECT to HPC3-SAS
PC SAS along with SAS/CONNECT is a powerful alternative to logging directly onto the HPC3 server and running SAS programs in a “shell” session. The main advantage is that you can avoid learning and remembering UNIX syntax and software, staying almost entirely in a Windows PC environment to access and process data on the Wharton HPC systems. In other words, SAS/CONNECT allows the user to make use of the resources of the remote server without having to work on it through SSH connection.
When running a SAS program that will make use of SAS CONNECT, the following steps are automatically executed by SAS:
- Sign on the remote server
- Run the program on the remote machine.
- Return to the local SAS the output and the log generated by running the program on the remote computer.
- Sign off the remote server
In order to use SAS/CONNECT and run a program remotely, the SAS program must contain some extra code (see SAS/CONNECT Connection Code).
At the beginning of the program add the code detailed in SAS/CONNECT Connection Code that allow the remote system to identify the user and establish the remote connection. Once the connection is established, it will remain for future instruction or programs, until PC SAS encounters the sign-off instructions.
When these lines are executed, a window will appear on the local system asking for username and password (Wharton credentials), which are then used to log into the remote server.
Since the sign-in is NOT required every time you run a program (unless you submit the sign-off lines), you do not need to write these lines at the beginning of every program. However, if you do that, PC SAS will check if a connection is already established, and in that case, it will just skip the sign-in part. Therefore, it is perfectly safe to write the sign-in lines at the beginning of every program you intend to be executed on the remote server.
The instruction to sign off the remote server is:
signoff;
SAS/CONNECT Connection Code
hpc3-sas.wharton.upenn.edu
%let grid=hpc3-sas.wharton.upenn.edu 7551; options comamid=TCP remote=GRID; signon username=_prompt_;
Encoded passwords in SAS/CONNECT connection script
It is possible to sign-on via SAS/CONNECT with a user’s encoded password directly stored in the logon code.
You can obtain an encoded password, while connected to the Grid, using the PROC PWENCODE statement as follows:
In PC-SAS:
proc PWENCODE in="MYPASSWORD"; run;
In SSH client:
echo 'proc PWENCODE in="MYPASSWORD";run;' | qrsh sas -nodms
“MYPASSWORD” the user’s password, typed in clear-text in the PROC PWENCODE statement.
The generated password is in the form {key}generated-password. SAS/CONNECT uses the key to decode the encoded password to its clear-text form, so both must be submitted.
For instance, a user with username user2008 and password My2008PW can sign-on using SAS/CONNECT with the following code (password must have quotes):
%let grid=hpc3-sas.wharton.upenn.edu 7551; options comamid=TCP remote=GRID; signon username=user2008 password="{sas001}TXkyMDAzUFc=";
Eventus in the Cluster
By default, for all users, we don’t ‘load’ Eventus when SAS starts, so you’ll have to add a line to your SAS code to do that, before you run Eventus commands:
%include '/wrds/eventus/pgm/evinit.sas';
Take a look at /usr/local/demo/SAS/Eventus for a few details and an example.