SAS

Description
SAS is a software package for statistical analysis and data management. It consists of a collection of integrated modules that include tools such as data management, statistics and mathematical analysis routines, a matrix-based programming language, and application development. SAS is particularly well-suited for statistical analysis of large data sets that exceed available RAM.

Availability

University Servers: SAS is currently installed on Kellogg's UNIX server, Skew, as well as on SSCC. It is also available on WRDS and WRDS Cloud.

Personal Computers: SAS for Microsoft Windows and Linux (Red Hat, CentOS, and Fedora) is available through a Northwestern site license that requires payment of an annual fee.

Vendor Information
SAS Institute, Inc.
SAS Campus Drive
Cary, NC 27513-2414
Phone: (919) 677-8000
Fax: (919) 677-4444

Support
For online tips and FAQs, see the links below.

You may submit a problem to SAS Technical Support using a web form. You will need to specify the site number and operating system; you can obtain this information from your SAS log file.

Running SAS
Every SAS session creates a LOG, where SAS writes any errors and warnings generated by commands issued by the user, and a listing (LST) of output. In batch sessions, the log and listing are written directly to an ASCII file with the same name as the program name, but with extensions "log" and "lst," respectively. In interactive windows sessions, the content of the LOG and Output windows has to be saved to a file manually by the user.

UNIX:

In order to:
The command is:
Start SAS Display Manager in X-Windows
sas
Start SAS in Interactive Line Mode
sas -nodms
After an initialization message, you will see the SAS line prompt:
1?
End a SAS Interactive Line Mode Session
endsas;
Run a SAS Job ("filename.sas")
sas filename
To run it in the background:
sas filename &
Run SAS with More RAM Memory
The maximum default is 64MB. To raise the limit to 128MB, for example,
use the "memsize" option when you start SAS:
sas -memsize 128M filename
For more SAS system options, refer to SAS Unix Environments Documentation.
To look at the defaults set for Skew, look at the
"sasv8.cfg" file in /usr/local/sas-8.1
Suppress the Creation of a Log File
Route the log to /dev/null using the SAS log system option:
sas -log /dev/null filename &


Examples and Solution

SAS samples installed with the application:
Users of SAS in Skew can browse and copy the samples by going to /usr/local/sas-9.4/SASFoundation/9.4/samples. Users who have installed SAS on their Windows desktop machine will find samples within the directory for each module of SAS. The exact location of the "SAS Institute" directory depends on the choices made during the installation.

The sample programs from many of the SAS publications are available online in SAS Online Samples.

"Bug" in PROC EXPORT: The EXPORT procedure, which can be used to translate a SAS data file into CSV, DBF, and other formats, has a problem under version 8. The problem is that even in batch mode these procedures try to display the SAS Session Manager icon, which requires a valid X display. The alternative option for batch job in SAS is sas -noterminal filename.

Setting default options for a SAS session ("autoexec.sas"): Users may create a file called "autoexec.sas" in their home directory and include in it any valid SAS statement or option. This file is executed by SAS immediately after it initializes. Thus, it is a convenient tool to avoid issuing LIBNAME and OPTIONS statements that are used in every program. For example, the following lines could be placed in an "autoexec.sas" file, allowing the user to refer to these libraries in any SAS program:

options ls=80 nocenter nodate;
libname mywork '~/research';
libname oldfiles v612 '~/sasv6files';

Note that SAS system options (memory size, sort size, work directory, etc.) will not be executed within a SAS program. These options must be specified before SAS initializes, either from the command line or by pointing to an alternative SAS configuration file.

Suppressing the log file: In Unix, to supress the creation of a SAS log file altogether, send the log to the null device, /dev/null. For example:

sas -log /dev/null your_program

Tips for saving space in your Unix account: SAS offers a macro called "squeeze." Refer to the SAS Technical Tip "SQUEEZE-ing Before Compressing Data." Also, you may look into the SAS COMPRESS option.

Sample programs at Kellogg

Useful Links

Help from SAS Institute: The SAS web page provides many samples and useful articles about its products. 

News Groups and Listservs: The following is a short list of SAS help/discussion sources independent of SAS Institute. Both are followed by SAS experts in different disciplines (including SAS personnel) and thus are good fora to ask a programming question.

  • SAS news group, news:comp.soft-sys.sas
  • SAS listserv, SAS-L, is mirrored by several other listservs; from the link above, you may browse and search the archives. You may also subscribe to the listserv, which has a lot of traffic. SAS-L messages can also be seen in the news group.

Tutorials: