

LOG to document in-class sessions 9/5 and 9/8/08 
================================================

[1037] (11:57am) maclaurin% xhost wam.umd.edu
wam.umd.edu being added to access control list

1038] (11:58am) maclaurin% ssh slud@wam.umd.edu
slud@wam.umd.edu's password: ********    

rac2:~: tap sas

rac2:~: sas &    

[LOTS OF WINDOWS COME UP !!! MINIMIZE ALL BUT LOG, 
OUTPUT AND PROGRAM EDITOR WINDOWS !!]

rac2:~: emacs &     
[THE WORD-PROCESSOR I USE FOR CUTTING AND PASTING INTO 
 TEXT LOG-FILES CONTAINING SAS CODE AND RESULTS.]


[NOW COPY FROM WEB-BROWSER WINDOW CONTAINING DATA
http://www.math.umd.edu/~evs/s430.old/Data/nature02801-s2.dat]

data Polynes1;
  input ID Archip $  Islnd $ ForstRep  Deforstn  Area   NrArea  
  Isol_25 Isol_75  Elev   LatitS  Rain  Age PctMakat  Dust Tephra ;
 datalines;
15 Vanuat ErromanL   3        3        902    1482     45     100      886    18.3   1740   2     0      370    3
16 Vanuat ErromanW   3        3        902    1482     45     100      886    18.3   2822   2     0      370    3
17 Vanuat EspirSant  3        2       3900    6700     30     550     1879    15     3108   2     0      370    3
18 Vanuat Tanna      3        3        572    1482     45      45     1084    19     1643   2     0      370    3
19  Fiji  Lakeba     3        4         56      56     30      70      220    18.14  1930   3     0      260    3
20  Fiji  Rotuma     3.5      3         60      60    500     500      256    12     3533   3     0      260    3
21  Fiji  TaveuniL   3        2        431    5966     10      10     1241    16.50  2506   2     0      260    3
22  Fiji  TaveuniW   3        2        431    5966     10      10     1241    16.50  5784   2     0      260    3
23  Fiji  VanuLevL   3        4       5535    5966     65      65     1032    16.3   2445   3     0      260    3
24  Fiji  VanuLevW   3        3       5535    5966     65      65     1032    16.3   2404   3     0      260    3
25  Fiji  VitiLevL   3        4      10384   10384     65    1170     1323    17.5   1922   3     0      260    3
26  Fiji  VitiLevW   3        3      10384   10384     65    1170     1323    17.5   3158   3     0      260    3
27 Mcrones  Kosrae   4        2        109    109     550     550     629      5     5000   3     0      230    2
28 Mcrones  Yap      4        3        100    100     450     450     174     -9.3   3023   3     0      750    2
29 NewZea  NorthIsl  1        2     114453  266917     30      30     2797    38     1145   2     0      140    3
30 NewZea  SthIsl(E  1        4     150718  266917     30      30     3764    43.3    685   3     0      140    3
;
run;

data Polynes2;
   set Polynes1 (keep = Archip Islnd Deforstn  Area Isol_25  
        Elev   LatitS  Rain  Age)  ;
   run;

[THIS TIME THE LOG SHOWS 16 RECORDS BUT ONLY 9 INSTEAD OF 16
VARIABLES.]

options nocenter linesize=80;

proc print; run;

[NOW THE RESULTS ARE DISPLAYED IN THE OUTPUT WINDOW.]

proc plot data=polynes2;
   plot rain * deforstn ;
run;

[FAIRLY UGLY CHARACTER-BASED SCATTERPLOT]


proc univariate data=Polynes2;
   title "Descriptive Stats";
   var elev;
   histogram;
      run;

proc sort data=Polynes2;
  by deforstn;


libname home ".";
data home.Polynes2;
   set Polynes2;
 run;

[ at this point there is a file "polynes2.sas7bdat"
  in the home directory from which I invoked SAS ]


proc univariate data=Polynes2 PLOT;
   title "Descriptive Stats";
   var elev;
   by deforstn;
      run;

* ================= New Session  ;

libname mydir ".";

data Polynes3;
   set mydir.polynes2;
 run;

proc print; /* could also say proc print data=Polynes3  */
           run;

* to print observations 5 to 12 -- the ones with Archip="Fiji"
  can do one of two things ;

   PROC PRINT  data=polynes3;
             where Archip = "Fiji";
             run;

* the other way is first to subset the data by obs number ;

   data polynes4;
      set polynes3;
      if _N_ > 4 and _N_ <= 12;
   proc print; run;

* Next time discuss PROC MEANS ;

