** UNIX INSTRUCTIONS FOR RUNNING SAS PROGRAMS NON-INTERACTIVELY **

1. Log on to SOLIX.

2. To create a new file, use the pico command. This is a similar editor to pine used in the mail system.

Be careful to use lower case letters since UNIX is case-sensitive.

Note that the % sign is the default UNIX prompt.

Note: ALWAYS use .SAS as the extension for your SAS programs so they are easy to find.

% pico freq.sas

This command should put you into a blank screen where you can begin typing your SAS commands.

|---------------------------------------------------------------------------------------------------------------------
|options ps=59 ls=80 ;
|proc format ;
|         value jobft 1 = 'yes' 2='no' ;
|data ;
|         infile 'students.dat' ;                     <---- Note if your program is in your home directory and your data file
|         input idno credits job gpa ;                           students.dat is in a subdirectory called projects, specify its location
|proc print ;                                                    in UNIX , e.g., infile '~/projects/students.dat'
|         var idno-- gpa ;
|         title 'Listing of all variables' ;
|proc freq ;
|         tables credits job gpa ;
|         format job jobft. ;
|         title 'Frequency tables for variables' ;
|-----------------------------------------------------------------------------------------------------------------------
Simply begin typing the SAS commands. You can use the arrow keys to move around and pico commands are on the bottom of the screen to help you. When you are done, exit as by holding down the control key and hit X (^X). Pico will ask if you want to "save the modified buffer", say Y for yes and it will ask if the "File name to write to" is freq.sas. If so, just hit return. The computer will tell you how many lines were written.
3. To run the SAS program, type
% sas freq You do not need to type the extension .sas
4. When the program is done running, the % prompt will appear. The directory command ls will show 2 new files, the .log and .lst files. The .log file will contain the command lines, computer time information, and any errors that have occurred with the SAS code. The .lst file contains the results from the SAS procedures. BOTH FILES must be checked to see if the procedures ran correctly. Note the * is a "wildcard" so that any file beginning with freq. will be listed.
% ls freq.*

freq.log freq.lst freq.sas

5. Check the .log and .lst files with pico or more for errors.
% more freq.log or % pico freq.log

% more freq.lst % pico freq.lst
(If you use the pico command, be sure to say N to "save modified buffer changes" if it appears and not Y so that the .log and .lst files are not inadvertently changed).

If there are errors you must edit the .sas file (% pico freq.sas) and make the necessary changes, then rerun the program(% sas freq ) and check the new .log and .lst files for errors.

If there are no errors, print the two files either in the lab room you are in or in PC436, where they will be filed for later pickup under your username. For example--

% lpr -P ipc413 freq.lst

% lpr -P ipc413 freq.log

or print all 3 files using the *

% lpr -P ipc413 freq.*

6. Because you have limited space on the computer, at some point you will probably need to delete your .lst and .log files.
% rm freq.l*

BUT be sure to save the .sas files since you can always rerun them if necessary. BE VERY CAREFUL using the * when deleting files. Once a file is deleted, it is gone. If you are using rm with a wildcard specification, it is a good idea to test it first with an ls command to see what files are matched.

You can also copy a SAS command file to a new one and edit the new program for other analyses.

% cp -i freq.sas newprog.sas The -i will tell you if there is already a program called newprog.sas and do you want to write over it.

7. To terminate the session, logoff the computer.
% logout

WWW.SAS.COM

Back To Statistical Consulting
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

.                                                                            .                                                                                 .