Statistical analysis system

SAS INTRODUCTION


Introduction
Goals
This course is an introduction to SAS programming.  The target audience includes graduate students in various fields who are planning to take statistical methods courses that require SAS programming, as well as students of statistics who plan to use SAS extensively.  The course may serve as a starting point for those wishing to become certified in SAS programming.  For statisticians and researchers, a good working knowledge of SAS is a highly marketable skill.  There are also excellent career opportunities for those who are interested in specializing in SAS Programming.  Since the needs of individual students vary widely, our goals will be to:
  1. Acquire SAS skills to support what will be learned in Statistics classes (most actual analysis techniques will be left to the appropriate STAT class).
  2. Acquire skills in data handling and data display that will be useful in a variety of research settings.
  3. Develop an ability to learn new techniques through familiarity with help, manuals, and other sources of information.
  4. Glimpse the power and possibilities of SAS.


    What is SAS?  Who is SAS?
    SAS  is produced by the SAS Institute in Cary, NC.  It is the most powerful and comprehensive statistics software available.  We should avoid calling SAS a "program," since we write "programs" in SAS.  But it is also not appropriate to refer to SAS as a "language" like C++, Fortran, etc.  SAS actually contains several computer languages within it.  Even "application" doesn't seem to fully describe SAS, so maybe we should just use the term SAS gives itself at the top of its output, "The SAS System."
    In 1976 the SAS Institute came out with its first software, a mainframe-based statistical analysis software package.  Since then, SAS has enjoyed phenomenal growth.  Its software is available for all the major platforms, and has grown beyond statistics to a variety of data management and business applications.  To read more about SAS, see their website at www.sas.com.  A history timeline is given here.
    SAS is also a community.  Users groups (SUGINDSUGRRVSUG) provide opportunities to interact with other SAS enthusiasts, hold conferences and publish articles about SAS programming techniques.  There is even an annual SAS ballot, in which users can vote for the changes and enhancements they would like to see SAS work on.



    Introduction
    A Simple Example
    Before getting started on the technical details of SAS programming, we'll look at a simple example.
    When you open SAS, you will see something similar to the picture below.  The three windows on the right, Log, Output, and Editor, will most likely be overlapping.  Here they have been arranged so you can see them all.  Below these windows there is a task bar with buttons that allows easy switching between windows.  The log contains a record of what SAS does, together with error messages and other information.  At this point there is already some information in the Log relating to the startup process.  On the left, you see a pane called Explorer.  Notice there are tabs at the bottom.  This pane can be switched between Explorer and Results.

    Now suppose we have some data on course grades and percent attendance, as follows:
    89 90
    98 95
    76 80
    64 55
    85 100
    93 95
    88 95
    79 65
    72 85
    Let's analyze this data.
    First, we have to get the data into SAS.  Here's a way to do it:

    This SAS program will create a dataset called "grades" with two variables called "grade" and "attend."  There are nine observations.  Type this program into the editor, then submit it by clicking the "running man" icon in the toolbar.  The log will show some notes about the creation of the dataset.

    This is the only result you can immediately see from running this program.  It doesn't produce any output, it just creates a dataset.  It is important to check the log when running a program like this, or you may not know if it has run correctly.
    The existence of the dataset can also be verified by looking at the explorer pane on the right.  Double-click the file-cabinet icon called Libraries, then the file-drawer icon called Work.  You will see a spreadsheet-like icon called "Grades."  You can also double-click this icon to open a spreadsheet view of the data.

    Now that we have data in SAS, what can we do with it?  Lots of things, of course!  But this is a simple example.  We will demonstrate two of the most commonly used procs (procedures) in SAS.  The first is proc print. This will produce formatted output with headings, page numbers, page breaks, and so forth, suitable for printing.  It doesn't actually send the output to the printer, but displays it in the output window. The second is proc plot, which is used for producing simple scatterplots of two variables.  The commands for these procedures are shown below, together with the commands that create the dataset.

    The results of proc print and proc plot will be shown in the output window, and will look something like this (examples here are modified to reduce the size):


    That's the end of our simple example.  Now we're ready to begin in earnest!

No comments:

Post a Comment