VII.
Correlation, Chi-square, & t-tests
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 bi-variate
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. Chi-square 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 chi-square 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 t-values
for variances assumed equal and variances not assumed equal.
First, we can run an independent groups t-test.
PROC TTEST DATA=example1;
CLASS candy;
VAR recall1;
RUN;
Second, we can run a dependent groups t-test
(sometimes called: related groups t-test, paired
samples t-test, or repeated measures
t-test).
PROC TTEST DATA=example1;
PAIRED recall1*recall2;
RUN;
Third, we can run the seldom used single sample t-test
(here the null supposes the true mean of recall 1 = 15).
PROC TTEST DATA=example1 HO=15;
VAR recall1;
RUN;
|