/* -------------------- Exercise 14.9 -------------------- */ data f;set sg.ex14_9;proc print;run; ods html; title 'The professor swims'; symbol1 v =':' c = blue h = 2; proc gplot data = sg.ex14_9; plot pulse*time; run; quit; goptions reset = all; ods html close; proc corr data =sg.ex14_9 noprob; var pulse time; run; /* proc reg data =sg.ex14_9; model pulse = time; run; quit;*/ /* -------------------- Exercise 14.10 -------------------- */ /* -------------------- Exercise 14.10 (a) -------------------- */ ods html; symbol i=none v='*' h=2 c=blue; proc gplot data = sg.ex14_10; where gender='f'; plot rate*mass; run; quit; ods html close; goptions reset = all; /* -------------------- Exercise 14.10 (b) -------------------- */ ods html; title 'Lean body mass and metabolic rate'; symbol1 i=none v='>' h=2 c=blue; symbol2 i=none v='*' h=2 c=red; /* define horizontal axis characteristics */ axis1 label=(h=2.5 'Mass in kg') major=(mass=0.5) minor=none; /* vertical axis characteristics */ axis2 label=(h=2.5 'Rate') major=(rate=0.5) minor=none; *symbol1 color=black interpol=none height=2.5 value=circle; proc gplot data = sg.ex14_10; plot rate*mass=gender/frame haxis=axis1 vaxis=axis2;; run; quit; goptions reset = all; ods html close; proc sort data= sg.ex14_10; by gender; run; proc corr data=sg.ex14_10; by gender; run; /* -------------------- Exercise 14.12 -------------------- */ data ex14_12n; set sg.ex14_12; femur=femur/100; humerus=humerus*10; status=1; keep status femur humerus; proc print; run; data sg.ex14_12n; set ex14_12n sg.ex14_12; keep status femur humerus; run; ods html; title 'Femur and Humerus Measurements'; symbol1 i=none v='star' h=2 c=blue; symbol2 i=none v='star' h=2 c=red; axis1 label=(h=2.5 'Femur length') major=(femur1=0.5) minor=none; axis2 label=(h=2.5 'Humerus length') major=(humerus1=0.5) minor=none; *symbol1 color=black interpol=none height=2.5 value=circle; proc gplot data = sg.ex14_12n; plot humerus*femur/overlay frame haxis=axis1 vaxis=axis2; *plot2 humerus*femur/frame haxis=axis1 vaxis=axis2; run; quit; ods html close; /* -------------------- Exercise 16.5 -------------------- */ data sg.MN16_5; input CPI Year; datalines; 38.8 1970 41.8 1972 49.3 1974 56.9 1976 65.2 1978 82.4 1980 96.5 1982 103.9 1984 109.6 1986 118.3 1988 130.7 1990 140.3 1992 148.2 1994 156.9 1996 163 1998 172.2 2000 179.9 2002 ; proc print; run; ods html; title 'CPI, 1970-2004'; symbol1 i=none v='star' h=2 c=blue; axis1 label=(h=2.5 'Year') major=(year=0.5) minor=none; axis2 label=(h=2.5 'CPI') major=(CPI=0.5) minor=none; *symbol1 color=black interpol=none height=2.5 value=circle; proc gplot data = sg.MN16_5; plot CPI*Year/haxis=axis1 vaxis=axis2; *plot2 humerus*femur/frame haxis=axis1 vaxis=axis2; run; quit; ods html close; /* -------------------- Exercise 16.18-------------------- */ data sg.MN16_18; input tuition Year CPI; cpi_83=100; cpi_new=1008*CPI/cpi_83; tuition_1983=tuition/(1008*CPI/cpi_83); datalines; 1008 1983 100 1275 1985 107.6 1474 1987 113.6 1636 1989 124 1855 1991 136.2 2022 1993 144.5 2174 1995 152.4 2258 1997 159.95 2340 1999 166.6 2502 2001 177.1 2908 2003 184 ; proc print; run; goptions reset = all; ods html; title 'Tuition, 1983-2003'; symbol1 i=none v='star' h=2 c=blue; symbol2 i=none v='plus' h=2 c=red; axis1 label=(h=2.5 'Year') major=(year=0.5) minor=none; axis2 label=(h=2.5 'Tuition, $$') major=(tuition=0.5) minor=none; *symbol1 color=black interpol=none height=2.5 value=circle; proc gplot data = sg.MN16_18; plot tuition*Year/overlay haxis=axis1 vaxis=axis2 vaxis=(0 500 1000 1500 2000 2500 3000); plot2 cpi_new*Year/frame haxis=axis1 vaxis=axis2 vaxis=(0 500 1000 1500 2000 2500 3000); run; quit; ods html close; data h1; set sg.MN16_18; ind=0; keep tuition ind year; proc print; run; data h2; set sg.MN16_18; tuition=cpi_new; ind=1; keep ind tuition year; proc print; run; data h; set h1 h2; proc print; run; goptions reset = all; ods html; title 'Tuition, 1983-2003'; symbol1 i=none v='star' h=1 c=blue; symbol2 i=none v='plus' h=1 c=red; axis1 label=(h=1 'Year'); axis2 label=(h=1 'Tuition, $$') ; footnote1 h=1.5 c=black f=simplex 'Tuition: original ' c=blue f=simplex '*' c=black f=simplex ' In constant 1983 $ ' c=red '+'; *symbol1 color=black interpol=none height=2.5 value=circle; legend1 value=none label=none; *legend1 value=('Original' 'In constant 1983 $') label=none; proc gplot data = h; plot tuition*Year=ind/haxis=axis1 vaxis=axis2 nolegend ; *axis label=none; run; quit; ods html close; /* Example 1.2: Computing Correlations between Two Sets of Variables The following statements create a data set which contains measurements for four iris parts from Fisher's iris data (1936): sepal length, sepal width, petal length, and petal width. Each observation represents one specimen. *------------------- Data on Iris Setosa --------------------* | The data set contains 50 iris specimens from the species | | Iris Setosa with the following four measurements: | | SepalLength (sepal length) | | SepalWidth (sepal width) | | PetalLength (petal length) | | PetalWidth (petal width) | | Certain values were changed to missing for the analysis. | *------------------------------------------------------------*; */ data Setosa; input SepalLength SepalWidth PetalLength PetalWidth @@; label sepallength='Sepal Length in mm.' sepalwidth='Sepal Width in mm.' petallength='Petal Length in mm.' petalwidth='Petal Width in mm.'; datalines; 50 33 14 02 46 34 14 03 46 36 . 02 51 33 17 05 55 35 13 02 48 31 16 02 52 34 14 02 49 36 14 01 44 32 13 02 50 35 16 06 44 30 13 02 47 32 16 02 48 30 14 03 51 38 16 02 48 34 19 02 50 30 16 02 50 32 12 02 43 30 11 . 58 40 12 02 51 38 19 04 49 30 14 02 51 35 14 02 50 34 16 04 46 32 14 02 57 44 15 04 50 36 14 02 54 34 15 04 52 41 15 . 55 42 14 02 49 31 15 02 54 39 17 04 50 34 15 02 44 29 14 02 47 32 13 02 46 31 15 02 51 34 15 02 50 35 13 03 49 31 15 01 54 37 15 02 54 39 13 04 51 35 14 03 48 34 16 02 48 30 14 01 45 23 13 03 57 38 17 03 51 38 15 03 54 34 17 02 51 37 15 04 52 35 15 02 53 37 15 02 ; /*The following statements request a correlation analysis between two sets of variables, the sepal measurements and the petal measurements. */ ods html; ods graphics on; title 'Fisher (1936) Iris Setosa Data'; proc corr data=Setosa sscp cov plots; var sepallength sepalwidth; with petallength petalwidth; run; ods graphics off; ods html close;