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:
- be comfortable "navigating through the WWW with netscape"; explore the course calendar,and look ahead at the lab for next week.
-
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.
- Logging in and Introduction to SUN workstations
- Using Netscape (same as the handout on WWW)
- Starting SAS from UNIX
- Reading in a SAS data set
- Starting SAS/INSIGHT
- Choosing and manipulating
a data set
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.
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:
- Globals
- Analyze ->
- 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.