
LOG to document Stat 430 in-class session 9/10/08 
=================================================


[1012] (1:02pm) maclaurin% sftp slud@wam.umd.edu
Connecting to wam.umd.edu...
slud@wam.umd.edu's password:
sftp> ls
ASCdata             LEC2log             Mail                Mailboxes
NCESdata            News                SASdat              epilep.RData
epilepsy.sas7bdat   pgm.asv             polynes2.sas7bdat   sasuser.v91
sftp> get polynes2.sas7bdat
Fetching /afs/glue.umd.edu/home/glue/s/l/slud/home/polynes2.sas7bdat
to polynes2.sas7bdat 
/afs/glue.umd.edu/home/glue/s/l/slud/home/pol 100%   16KB  16.0KB/s   00:00


* [Now started new SAS session] ;

libname mydir ".";

data Polynes3;
   set mydir.polynes2;
 run;

    proc sort data=polynes3;
          by     elev;
 options nocenter linesize=80;
     proc print data=polynes3 (obs=6);
       run;

Obs  Archip   Islnd     Deforstn  Area  Isol_25  Elev  LatitS  Rain  Age

  1  Mcrones  Yap           3      100    450     174   -9.30  3023   3
  2  Fiji     Lakeba        4       56     30     220   18.14  1930   3
  3  Fiji     Rotuma        3       60    500     256   12.00  3533   3
  4  Mcrones  Kosrae        2      109    550     629    5.00  5000   3
  5  Vanuat   ErromanL      3      902     45     886   18.30  1740   2
  6  Vanuat   ErromanW      3      902     45     886   18.30  2822   2
Three other ways to print the same thing:

  proc print data = polynes3;
        where ELEV < 1000 ;
   run;

* OR, using the SAS-defined variable _N_ which counts obs number ;

  data temp;
    set polynes3;
    IF _N_ <= 6;
  proc print; run;

* OR ;

   data temp2;
    set polynes3;
    IF ELEV < 1000;
  proc print; run;

*------------------------------------------
   NEXT STEPS: use of PROC's  UNIVARIATE, MEANS
     to give descriptive statistics    

  first, "univariate" gives means, variances, min max,
     and lots of other things, 
   and with "plot" option also boxplots  etc. ;


PROC UNIVARIATE data=polynes3 ;
    var elev deforstn rain LatitS ;
  run;

* LOTS of OUTPUT HERE !! ;

PROC MEANS data=polynes3 ;
    var elev deforstn rain LatitS ;
   title "Whatever you want";
  run;

Whatever you want                      13:07 Wednesday, September 10, 2008  17

The MEANS Procedure

Variable     N            Mean         Std Dev         Minimum         Maximum
------------------------------------------------------------------------------
Elev        16         1235.44     934.3954173     174.0000000         3764.00
Deforstn    16       2.9375000       0.7719024       2.0000000       4.0000000
Rain        16         2678.00         1313.73     685.0000000         5784.00
LatitS      16      17.3962500      11.5629505      -9.3000000      43.3000000
------------------------------------------------------------------------------



PROC MEANS data=polynes3 median q1 q3 maxdec=2;
    var elev deforstn rain LatitS ;
   title "Different statistics";
  run;


Different statistics               13:07 Wednesday, September 10, 2008  19

The MEANS Procedure

                                   Lower           Upper
Variable          Median        Quartile        Quartile         Maximum
------------------------------------------------------------------------
Elev             1058.00          757.50         1323.00         3764.00
Deforstn            3.00            2.00            3.50            4.00
Rain             2475.50         1831.00         3133.00         5784.00
LatitS             17.00           15.65           18.30           43.30
------------------------------------------------------------------------


PROC UNIVARIATE data=polynes3  plot;
   var elev deforstn;
  run;


Different statistics                  13:07 Wednesday, September 10, 2008  22

The UNIVARIATE Procedure
Variable:  Elev

... [after skipped output]

   Stem Leaf                     #  Boxplot
      3 8                        1     *
      3
      2 8                        1     0
      2
      1 9                        1     |
      1 0012233                  7  +--+--+
      0 699                      3  +-----+
      0 223                      3     |
        ----+----+----+----+
    Multiply Stem.Leaf by 10**+3


The UNIVARIATE Procedure
Variable:  Elev

                       Normal Probability Plot
    3750+                                           *      +
        |                                            ++++++
        |                                      *+++++
        |                                  +++++
        |                            ++++++ *
        |                       **+**   *
        |                 *+*+++
     250+       *    *++*++
         +----+----+----+----+----+----+----+----+----+----+
             -2        -1         0        +1        +2


* Similar plots for variable  Deforstn    ;



   proc sort data=polynes3 out=polynes4;
       by deforstn;
    PROC UNIVARIATE data=polynes4   plot;
       var elev ;
       by deforstn;
      run;

The UNIVARIATE Procedure

... lots of [skipped] output

Variable:  Elev

Schematic Plots

         |
    4000 +
         |                                    |
         |                                    |
         |                                    |
    3000 +                                    |
         |            |                       |
         |            |                    +-----+
         |            |                    |     |
    2000 +         +-----+                 |     |
         |         |     |                 |     |
         |         |  +  |                 |  +  |
         |         *-----*        |        *-----*
    1000 +            |        *-----*     |     |
         |            |        |  +  |     +-----+
         |                     |     |        |
         |                     +-----+        |
       0 +
          ------------+-----------+-----------+-----------
Deforstn                 2           3           4



PROC FREQ  data=polynes3; 
   tables deforstn age deforstn*age;
 title "A Few Frequency Tables"; 
  run;


A Few Frequency Tables                15:08 Wednesday, September 10, 2008   3

The FREQ Procedure

                                     Cumulative    Cumulative
Deforstn    Frequency     Percent     Frequency      Percent
-------------------------------------------------------------
       2           5       31.25             5        31.25
       3           7       43.75            12        75.00
       4           4       25.00            16       100.00


                                Cumulative    Cumulative
Age    Frequency     Percent     Frequency      Percent
--------------------------------------------------------
  2           7       43.75             7        43.75
  3           9       56.25            16       100.00


A Few Frequency Tables               15:08 Wednesday, September 10, 2008   4

The FREQ Procedure

Table of Deforstn by Age

Deforstn     Age

Frequency|
Percent  |
Row Pct  |
Col Pct  |       2|       3|  Total
---------+--------+--------+
       2 |      4 |      1 |      5
         |  25.00 |   6.25 |  31.25
         |  80.00 |  20.00 |
         |  57.14 |  11.11 |
---------+--------+--------+
       3 |      3 |      4 |      7
         |  18.75 |  25.00 |  43.75
         |  42.86 |  57.14 |
         |  42.86 |  44.44 |
---------+--------+--------+
       4 |      0 |      4 |      4
         |   0.00 |  25.00 |  25.00
         |   0.00 | 100.00 |
         |   0.00 |  44.44 |
---------+--------+--------+
Total           7        9       16
            43.75    56.25   100.00


