SAS for Linux

SAS is a general purpose, statistical package and high level data management programming language from the SAS Institute in Cary, North Carolina. SAS is widely used in academia and industry.

SAS for Linux, Version 9.4 (TS1M2) is available on compute server charisma. A Sociology Linux account is required for use.

1. Modes of Access

2. Web Access via SAS Studio

SAS Studio, of recent origin in the SAS product line, provides a web-based method of SAS delivery, of particular importance to the growing legion of OS X users for whom SAS is not readily available. Terminal access methods are powerful, but resisted by those wanting fewer connectivity issues.

A few particulars about SAS Studio for Duke Sociology:

2.1. Connecting to SAS Studio

  1. Open your web browser to

  2. Complete the standard Duke SIGN IN page with your NetID credentials. A self-signed certificate is currently in use. Accept this certificate. Chrome requires acceptance each time.

  3. The SAS Studio Sign-In screen appears. Enter your Sociology userid and password.


  4. Sign-in proceeds and an opening screen similar to below appears.


2.2. Mastering SAS Studio

3. Terminal Access via SSH

3.1. SSH Access Requirements

Windows users require:

Prior to opening a SAS session:

Mac users require:

Prior to opening a SAS session:

3.2. Invoking SAS and Submitting Programs

Once a tunnelled SSH connection to charisma is established, SAS may be run in interactive or batch mode. When learning SAS, interactive mode is preferrable. Experienced SAS users often come to prefer batch mode, especially for complex programs that require hours or days to complete.

3.3. Interactive Mode SAS

To invoke interactive SAS, change to the directory in which you wish to work and type:

Placement of the ampersand (&) after the command returns the terminal command prompt, leaving the command line available for other activity.

The SAS splash screen appears momentarily followed by seven windows:


The Linux SAS program editor is quite different from the Windows SAS editor. It should be reconfigured to behave like the Windows editor, as described in Giving the SAS Program Editor Under Linux a Windows Look and Feel.

3.4. Handling Interactive Mode Output

Interactive Linux SAS produces two output formats.

Curiously HTML output only displays when you have previously opened the firefox browser on charisma. Otherwise it is generated, but doesn't display. Notably an open browser is also a prerequisite for accessing features through SAS Help menus.

If HTML output matters not to you, suppress it from any window by selecting Tools > Options > Preferences > Results Tab. Deselect Create HTML. The Create Listing option remains in effect. Click OK.

Printing log and output listings can be bewilderingly complex in SAS. For the sake of simplicity, a reasonable printing template is preconfigured. You just need to decide your preferred network printer.

  1. From a Log or Output window select File > Print to open the print dialog window.

    • A default PostScript Duplex driver is used to provide double-sided printing

    • Linesize is 110 characters
    • Pagesize is 71 lines
    • An 8 point monospace font is default
    • All margins are 0.75 inches


  2. Click Properties..., then the Destination Tab in the resulting window. Note the initial defaults.

    • Device type Disk

    • Destination

    These settings result in a PostScript file called being written to the directory from which you loaded SAS. Some may want this type of output, but the presumption here is the need for hard copy.


  3. Select the Device type dropdown pointer and change Disk to Printer. As shown below, output is now directed to the default network printer - copy2. Select a different network printer by typing an alternate printer name - lab or copy3 - into the Destination field.


  4. Click OK in the Printer Properties window. Click OK in the Print... window. Output should be directed to the default or specified printer.

  5. If your SAS Display Manager settings set to be permanent (as done with Tools > Options > Preferences... > DMS tab > Save Settings on Exit), any print modifications become permanent. The File > Print > OK sequence will consistently print to the same printer.

3.5. Batch Mode SAS

Batch mode is most appropriate for long or numerous production jobs where work needs to be pipelined through as efficiently as possible by an experienced SAS programmer.

3.5.1. Job Preparation

Batch mode SAS programs are easily maintained with a text editor such as vi, emacs or pico (see Linux Editing) or your preferred editor under Windows. By convention, .sas is the file name extension for SAS programs. Assume, for example, a program called

3.5.2. Job Submission

To submit the above program, type at the command line prompt:

Inclusion of the ampersand (&) returns the command line prompt, while SAS executes the program in the background, allowing you to do other work. When the job completes, SAS writes text file log and listing outputs to the current directory and reports job completion in the terminal window. Output files are named in tandum with the program file, so in this example, the result files are named recodes.log and recodes.lst.

Running multiple batch jobs at once often further improves efficiency.

3.5.3. Viewing Output

Conveniently view batch results with the less paging command:

The less utility supports quick output paging and scanning for things of interest. Navigation involves simple keystrokes and string searches:

3.5.4. Printing Output

SAS batch output is printed from the command line. Assuming the example SAS job produces log and output files named recodes.log and recodes.lst, both are printed in duplex to the default Linux printer (copy2) with the enscript command:

The options control the page header (-G), toggle on duplexing (-DDuplex:true) and set font size (-fCourier8). These are recommended as optimal settings. Omit the duplex option if you want single-sided ouput.

Adding a printer specification sends to the alternate lab printer:

For more in-depth discussions see Linux Printing and Handling SAS Output Under Linux.

3.5.5. Cross Platform Access

Linux SAS programs and outputs saved under the user lanhome network directory are directly available to local Windows and OS X PCs when network mapping is in effect.

4. Online Help Resources

SAS provides documentation through searchable, online tools and through detailed manuals available as downloadable PDF files. The table below organizes some of the more useful documentation links for the 9.4 release. The online documentation is quickly searched and provides focused information. The PDFs are more detailed and broader in scope. SAS documentation applies to Windows and Linux unless otherwise noted.



SAS OnlineDoc 9.4
Recommend this be bookmarked. Has links to HTML listings of procedures and language elements.

Base SAS 9.4
List of core PDF documents and pointers into the online documentation for the base product

Computing Home | Sociology Home | Arts & Sciences Home | Duke Home