Running SAS on Hubert - a Unix Server for researchers at VCU
SAS File Naming Conventions |
|
Type of file: |
Filename extension: |
Program |
.sas |
List |
.lst |
Log |
.log |
SAS dataset |
.sas7bdat |
SAS Libname Conventions |
|
libname yourlib '~/project'; |
For 'project' directory located in home directory |
libname yourlib '.'; |
For current directory |
SAS Version 9.1.3 is available for use on Hubert.
Note: To use SAS interactively on Unix requires the use of an X-Windows program, such as Micro X Win32.
The following shows how to create and run a batch SAS program on Hubert:
- Login to your Unix account. After you login, the Unix command prompt (%) will be displayed.
- To keep your SAS files together in one location, make a folder (named 'project', for example) by
issuing the following command at the % prompt:
% mkdir project
- Change into your project folder and confirm your folder location:
% cd project
% pwd
This directory will be used in your SAS LIBNAME statements (although, in the example SAS program below, the special Unix symbol '~' is used to represent your home directory).
- Create a SAS program file (named 'sasdemo.sas', for example) using a text editor, such as pico, vi,
jove. This example will use pico:
% pico sasdemo.sas
- In the pico editor, type the following SAS program statements. Then save the file and exit the editor (press Ctrl+x):
*Create a SAS dataset called sample1 in the project directory in your home directory; LIBNAME yourlib '~/project'; *Limit the display to 80 columns for screen display; DATA yourlib.sample1 ; *Read in a raw data set called survey.dat located in the current directory; INFILE 'survey.dat' OBS=10 ; INPUT ITEM1 $ ITEM2 ITEM3 ; PROC PRINT DATA=yourlib.sample1; |
Note: Remember that in Unix filenames are case sensitive!
- To submit the sasdemo.sas program (in batch), issue:
% sas sasdemo
- To view your SAS log or list file:
% less sasdemo.log
% less sasdemo.lst
While viewing, type f to go forward, b to go backward, and q to quit.
- To print to your local pc printer (using
SSH Secure Shell to download the file to your PC, and Notepad to print it):
- Install SSH Secure Shell, according to the instructions found here, and create a profile for "hubert.vcu.edu" or "aurora.vcu.edu" or "neptune.vcu.edu". (This is a one-time procedure.)
- Launch SSH Secure Shell and connect to the desired Unix system via the profile you created above.
- When prompted, login to the Unix system.
- Click the Window menu item of SSH, and select New File Transfer. This will open a file transfer window that displays your local PC files on the left side and the files in your Unix home directory on the right side.
- Find the desired SAS log or list file among your Unix files (on the right side of the SSH file
transfer window).
If the file is not in your home directory, you will have to "change directory" to the appropriate directory. To change to a different directory, double-click on the directory's icon. Or, you can type the directory's path in the path box (located just above the file listing) and press Enter.
- Once you have located the desired file, double click on its icon. This will launch the
Windows Notepad editor and will display the file in the Notepad window.
In Notepad, you can also do the following:- To adjust fonts, select Format, Font...
- To adjust print layout (portrait vs. landscape), select File, Page Setup...
- To print the file on a local PC printer, select File, Print...
- If the batch SAS jobs you submit on Unix run for a substantial period of time, you can submit them to run
in the background by adding an ampersand '&' at the end of the command:
% sas sasdemo &
You will immediately be presented with another % command prompt, so that you can issue other commands or even logout, as desired. Your SAS program will continue to run in the background.
To see if your program is still running, issue the following command to view all your currently running processes:
% ps -ef | grep yourlogin
(substitute your Unix login for yourlogin).
- Your SAS WORK files on Unix are stored in the directory named '. _scratch' that is located in your home directory (note the period in the name). These files are usually automatically deleted immediately after your SAS program finishes execution.
