VII. Correlation,
Chisquare, & ttests The following covers some of the
most commonly used SAS procedures with which you can run some basic statistical
analyses. Use the File, Import Data... to import the
Example Data 1 file using the Import Wizard with SPSS File (*.sav) source
and member name example1 as
was done previously.
1. PROC CORR
In SAS, we use PROC CORR to examine bivariate relationships.
PROC CORR DATA=example1;
VAR age recall1 recall2;
RUN;
If we had missing data in at least one of the variables, then we could use a
'nomiss' optional statement to do listwise deletion. As an example, use the
Import Wizard to import the
Example Data 2 file using the Excel File (*.xls) source as was done
previously. Remember to use 'example2' as the member name to differentiate it
from example1.
PROC CORR DATA=example2;
VAR age recall1 recall2;
RUN; PROC CORR DATA=example2
NOMISS;
VAR age recall1 recall2;
RUN; 2. Chisquare tests using PROC FREQ We can use
proc freq to examine class standing (cl_st,
where 1 = freshman, 2 = sophomore, 3 = junior, & 4 = senior) by Sex
(males coded 1, females coded 0). Using the chi2 option we can
request a chisquare test that tests if these two variables are independent, as
shown below. PROC FREQ DATA=example1;
TABLES cl_st*Sex / CHISQ;
RUN;
We can also get the Fisher's exact test statistic using the modifier EXACT. PROC FREQ DATA=example1;
TABLES cl_st*Sex / CHISQ EXACT ;
RUN;
3. PROC TTEST We can use PROC TTEST to examine differences
between two groups. Notice in the output, we get tvalues for variances
assumed equal and variances not assumed equal.
First, we can run an independent groups ttest. PROC TTEST DATA=example1;
CLASS candy;
VAR recall1;
RUN;
Second, we can run a dependent groups ttest (sometimes called:
related groups ttest, paired samples ttest, or repeated measures
ttest). PROC TTEST DATA=example1;
PAIRED recall1*recall2;
RUN;
Third, we can run the seldom used single sample ttest (here the null
supposes the true mean of recall 1 = 15).
PROC TTEST DATA=example1 HO=15;
VAR recall1;
RUN;
