STA 210B/ENV 251: September 3, 1997

Introduction to UNIX workstations and SAS

Assignment

There is no written assignment to turn in, however you should do the following by lab next week:
  1. be comfortable "navigating through the WWW with netscape"; explore the course calendar,and look ahead at the lab for next week.
  2. Create a SAS Data set for the data in Problem 2.47 page 72 of the text book.

References

SAS/INSIGHT Users Guide, Chapters 2-3, pages 15-26

Topics

This lab session will go over the following topics: To go to any particular highlighted session, click on the highlighted text. You should be able to get back to this list by clicking on the Back box at the top of the page.
  1. Logging in and Introduction to SUN workstations
  2. Using Netscape (same as the handout on WWW)
  3. Starting SAS from UNIX
  4. Reading in a SAS data set
  5. Starting SAS/INSIGHT
  6. Choosing and manipulating a data set

Starting SAS

To start up SAS enter

	sas &
from the UNIX window. Three windows will appear: the Program Editor, Output Window, and a Log Window. The Program Editor is where you can put SAS commands for non-interactive analyses. We will be primarily using SAS/INSIGHT for interactive and exploratory statistics.


Creating a SAS Data Set via the Program Editor

Read Chapter 2: pages 15-21 in the INSIGHT Manual

To enter a data set using the Program editor, follow the steps in the following sample (don't forget the semi-colon!!!).You should type these statements in the PROGRAM EDITOR window. Italics indicate names specific to this data set that you can change as you like.

data sasuser.example;
input SAT GPA ;
datalines;
1270 3.65 
1000 3.27
1550 3.95
 800 2.65
 920 3.05
 700 2.17
; {NOTE: this semicolon tells SAS that this is the end of the data}
run;
Now, to get SAS to process this, go to the Locals pull-down menu and choose Submit. You should see "NOTE: 11 Lines submitted." You now have a SAS data set to use. If you don't see this, then there may be some typo or error in the commands. If you were successful, you created a SAS data set called example, that is stored in your SAS library called SASUSER. THe data set contains two variables called SAT and GPA that correspondto the two columns of numbers. For a more complicated example with categorical variables see page 16 in the INSIGHT manual.

Starting SAS/INSIGHT

Read Chapter 3: pages 23-26.

Now, to start up INSIGHT, follow these menus from the PROGRAM EDITOR:

  1. Globals
  2. Analyze ->
  3. Interactive data analysis

Choosing a Data Set

At this point the SAS/INSIGHT window opens and you can choose your data set. The library choice is SASUSER . Click on EXAMPLE ( this is the data set you created using the PROGRAM EDITOR window ). The data window will now appear in a spreadsheet format. Continue reading the SAS/INSIGHT User's Guide Chapter 3 for details on how to manipulate this window. For example, suppose you want to sort the data for the GPA column. Click on GPA . In the data window there is a little arrow in the upper left hand corner. Pressing on it allows you to sort and rearrange your columns.

Converting a file to a SAS data set

It is possible to read in data from a text file or from a spreadsheet. We will cover this method later on. For now the data sets will be small enough to enter using the program editor.