This is an example of a simple one-way ANOVA. The example data are taken from the Agresti data set.
DATA INCOME;
INPUT INCOME EDUC RACE Z1 Z2;
CARDS;
8 10 b 1 0
9 7 b 1 0
13 9 b 1 0
.
.
.
9 10 w 0 0
12 12 w 0 0
28 20 w 0 0
;
PROC ANOVA;
CLASSES RACE;
MODEL INCOME=RACE;
MEANS TYPE/ BON LINES;
RUN;
Use for generating descriptive statistics on quantitative data. The example data are taken from the Agresti data set.
DATA HOMES;
INPUT Price Size Bedrms Bathrms New;
CARDS;
48.5 1.10 3 1 0
55.0 1.01 3 2 0
68.0 1.45 3 2 0
137.0 2.40 3 3 0
.
.
.
280.0 3.85 4 3 0
PROC UNIVARIATE;
VAR Price Size;
RUN;
Use for generating histograms for both quantitative and qualitative data. The example data are taken from the Agresti data set.
DATA HOMES;
INPUT Price Size Bedrms Bathrms New;
CARDS;
48.5 1.10 3 1 0
55.0 1.01 3 2 0
68.0 1.45 3 2 0
137.0 2.40 3 3 0
.
.
.
280.0 3.85 4 3 0
PROC CHART;
VBAR New;Simple Bar Chart
PROC CHART;
VBAR Price/TYPE=PERCENT;Relative Frequency Histogram
RUN;
DATA RANNUMS;
DO N = 1 TO 10;
NUMBER = RANUNI(0);
OUTPUT;
END;
PROC PRINT; VAR NUMBER;
RUN;
To obtain more or less random numbers, change the line "DO N = 1 TO 10;" to "DO N = 1 TO X;" where X is how many random numbers you need.
Use for doing multiple regression analysis of quantitative data. For more elaborate procedures, such as ANCOVA, use PROC GLM.
DATA HOMES;
INPUT Price Size Bedrms Bathrms New;
S-Bed = Size * Bedrms;Creates interaction between Size and no. of bedrooms. CARDS; 48.5 1.10 3 1 0
55.0 1.01 3 2 0
68.0 1.45 3 2 0
137.0 2.40 3 3 0
.
.
.
280.0 3.85 4 3 0
PROC REG;
MODEL Price = Size Bedrms Bathrms New S-Bed;
OUTPUT OUT=RESIDS P=YHAT R=RESID;Saves residuals.
PROC PLOT;
PLOT RESID*(YHAT SIZE);Plots residuals by predicted values and Size.
PROC CHART;
VBAR RESID;Bar chart of residuals.
RUN;
Use for generating crude scattergrams for quantitative data. For high quality graphics, use PROC GRAPH.
DATA HOMES;
INPUT Price Size Bedrms Bathrms New;
CARDS;
48.5 1.10 3 1 0
55.0 1.01 3 2 0
68.0 1.45 3 2 0
137.0 2.40 3 3 0
.
.
.
280.0 3.85 4 3 0
PROC PLOT;
PLOT Price * Size;
RUN;
Use for testing hypotheses of the variety: µ2 - µ1 = 0.
DATA TWOSAMPL;
INPUT GROUP $ OUTCOME;
CARDS;
EXP 52 CONTR 60
EXP 77 CONTR 80
.
.
.
EXP 66 CONTR 60
PROC TTEST;
CLASS GROUP; VAR OUTCOME;
RUN;
Use for testing hypotheses of the variety: µd= 0.
DATA MATCHED;
INPUT SUBJECT $ TIME1 TIME2;
DIFF = TIME2 - TIME1; CARDS;
Sue 52 60
Bob 77 80
.
.
.
Sam 66 60
PROC MEANS T PRT;
VAR DIFF;
RUN;
Last modified: August 16, 1999