Information Technology Services

Using SAS on Abacus

This page discusses the use of SAS on abacus.nodak.edu, an IBM RS6000 host at NDSU. (It assumes that you have an abacus account and know how to logon to abacus. If you have questions about logging on to abacus, check with the ITS Help Desk.) Although one can invoke the SAS Display Manager on abacus, this is *not* the preferred method of accessing SAS here. Generally speaking, the most effective way to use SAS on abacus is to use the text editor of your choice (e.g., pico, vi, emacs, jove) to create a file containing the SAS statements you want to execute. You can then send the contents of the file to the SAS compiler which should generate appropriate output files under most circumstances.

I will use the following conventions for this web page. In places where I am giving you a command to type at the UNIX prompt, the text will look like this. I will put brackets around the word [return] to indicate that you should press the enter or return key. When you are supposed to hold down the control key and press another key, I will use a hyphen between control and the appropriate letter such as control-x (this means hold down the control key and then press the letter x).

Creating a SAS File | Running a SAS Program | Viewing SAS Output | Correcting Errors in SAS | Printing SAS Output


Creating a SAS File on Abacus

  1. From the UNIX prompt (the $), type: pico prob1.sas [return] . Although sas does not require you to use the .sas extension, we recommend you use this convention to help organize your SAS files. Notice that the extension is listed in lowercase letters, .sas not .SAS. If you use uppercase letters, the SAS compiler will not recognize the extension and you'll have to type the whole name to execute the file rather than just the filename before the extension.
  2. You should now be in the pico text editor. The cursor should be at the top of the screen. Key sequences are defined at the bottom of the screen. The carat preceding each key (e.g., ^O) refers to the control key. To save the contents of your file, use control-o (that's the letter oh, not the number zero). To exit from the file use control-x.
  3. Type in the contents of your file now. Press [return] to start a new line. When you have filled all available lines on the screen, press [return] to get additional blank lines. When you have entered all of your program, press control-o. The SAS program below (complete with a couple of errors as shown) is provided to allow you to practice in case you don't have a SAS program of your own.
    DATA CLASS;
       INPUT NAME $  SEX   AGE  HEIGHT  WEIGHT;
       CARDS;
    JOHN   M 12  59.0   99.5
    ALFRED M 14  69.0  112.5
    LOUISE F     56.3   77.0
    PHIL   M 16  72.0  150.0
    MARY   F 15  66.5  112.0
    ROBERT M 12  64.8  128.0
    ;;;;
    PROC PRINT;
    PROC SORT
       BY SEX;
    PROC MEANS;
       BYSEX;
    PROC PLOT;
       PLOT WEIGHT*HEIGHT=SEXX;
    
  4. To save the contents of your file, use control-o. Pico will then bring up a dialog box asking you to either confirm the name of the current file or to provide a new name for it. Press [return] to save the contents with the current name.
  5. To exit from your file back to the UNIX $ prompt at any time, use control-x. Pico will bring up a dialog box asking you if you want to save the changes to the file. Simply respond by pressing the letter Y to save the changes or the letter N to discard the changes.

Return to Top of Page


Running a SAS program on Abacus

  1. To execute the prob1.sas program created above, at the UNIX $ prompt type: sas prob1 [return]. Note that you need not type the .sas extension in this command. If you do not follow the convention of the .sas extension, then you must type the entire name of the file containing the SAS statements.
  2. If you have made errors in your program, you will have to scan the saslog file to locate them. By default, the saslog file is given the extension .log on abacus. For our example above, prob1.log is the name of the saslog file.

Return to Top of Page


Viewing Output from SAS on Abacus

  1. Executing the prob1.sas program created above should also generate a second output file by default. This file will be named prob1.lst and contains the results of the procedures called in the SAS program.
  2. To see the output files created by SAS (as well as all other files in your current directory), use the ls command. If you only want to see the output files, type: ls *.l* [return]. The asterisks are wildcards and refer to all other character combinations in the filename.
  3. Type: pico prob1.log [return] to open the saslog file associated with prob1.sas. Use control-v and control-y to move forward and backward through the file, respectively. To search for a character string while editing the file, use control-w to bring up a dialog window where you can specify the string to locate (like ERROR, :-)).
  4. If you do not find any indications of trouble in the prob1.log file, exit from the file using control-x and return to the $ prompt.
  5. Type: pico prob1.lst [return] to open the listing file associated with prob1.sas. This opens the prob1.lst file with the pico text editor. Again, use control-v and control-y to move forward and backward through the file, respectively. This file contains the information you are usually interested in.
  6. When you have finished scanning the prob1.lst file and want to return to the $ prompt, use control-x.

Return to Top of Page


Correcting Errors, Re-running a SAS Program on Abacus

If you determine from your saslog that your program has errors, follow the steps below:
  1. Edit the original prob1.sas program (i.e., in this case type: pico prob1.sas [return].
  2. Locate the errors in your file. Use the arrow keys to move the cursor to the location of the errors and type in the corrections.
  3. After entering all proposed corrections, save the file using control-o.
  4. Use the sas command (e.g., sas prob1) to execute the revised program.
  5. When the program execution has completed, edit the new saslog and scan for errors.
  6. If your program still has errors, repeat steps 1 through 5 until it becomes error-free.

Return to Top of Page


Printing SAS Output from Abacus

In most cases you will want to print your output files on one of the node printers associated with abacus. Generally this will be the noper1 printer located in IACC 142. You can check the default printer associated with your account by typing the following command (notice that PRINTER is in uppercase; also, the $ here does *not* refer to the UNIX prompt -- $PRINTER is the name of the shell variable that identifies your default printer) at the $ prompt: echo $PRINTER [return]. The response you get back is the name of the printer to which your output will be sent.

To print the listing file, use the command: lpr prob1.lst [return]. The lpr command can also be used to print the .log and .sas files.

Return to Top of Page


Home Menu
Comments, questions? Please contact Curt Doetkott
Last Modified: 3:21 PM Tue, Oct 2, 1996
Published by Information Technology Services