Fishers Exact Tests and Repeated Measure Analysis in SAS

Last updated on Sep 14 2022
Nitin Pawar

Table of Contents

Fishers Exact Tests and Repeated Measure Analysis in SAS

Fisher’s exact test is a statistical test used to determine if there are nonrandom associations between two categorical variables.In SAS this is carried out using PROC FREQ. We use the Tables option to use the two variables subjected to Fisher Exact test.

Syntax

The basic syntax for applying Fisher Exact test in SAS is −

PROC FREQ DATA = dataset ;
TABLES Variable_1*Variable_2 / fisher;

Following is the description of the parameters used −

• dataset is the name of the dataset.

• Variable_1*Variable_2 are the variables form the dataset .

Applying Fisher Exact Test

To apply Fisher’s Exact Test, we choose two categorical variables named Test1 and Test2 and their result.We use PROC FREQ to apply the test shown below.

Example

data temp;
input Test1 Test2 Result @@;
datalines;
1 1 3 1 2 1 2 1 1 2 2 3
;

proc freq;
tables Test1*Test2 / fisher;
run;

When the above code is executed, we get the following result −

sas 4

SAS – Repeated Measure Analysis

Repeated measure analysis is used when all members of a random sample are measured under a number of different conditions. As the sample is exposed to each condition in turn, the measurement of the dependent variable is repeated. Using a standard ANOVA in this case is not appropriate because it fails to model the correlation between the repeated measures.

One should be clear about the difference between a repeated measures design and a simple multivariate design. For both, sample members are measured on several occasions, or trials, but in the repeated measures design, each trial represents the measurement of the same characteristic under a different condition.

In SAS PROC GLM is used to carry out repeated measure analysis.

Syntax

The basic syntax for PROC GLM in SAS is −

PROC GLM DATA = dataset;

CLASS variable;

MODEL variables = group / NOUNI;

REPEATED TRIAL n;

Following is the description of the parameters used −

• dataset is the name of the dataset.

• CLASS gives the variables the variable used as classification variable.

• MODEL defines the model to be fit using certain variables form the dataset.

• REPEATED defines the number of repeated measures of each group to test the hypothesis.

Example

Consider the example below in which we have two groups of people subjected to test of effect of a drug. The reaction time of each person is recorded for each of the four drug types tested. Here 5 trials are done for each group of people to see the strength of correlation between the effect of the four drug types.

DATA temp;

INPUT person group $ r1 r2 r3 r4;

CARDS;

1 A 2 1 6 5

2 A 5 4 11 9

3 A 6 14 12 10

4 A 2 4 5 8

5 A 0 5 10 9

6 B 9 11 16 13

7 B 12 4 13 14

8 B 15 9 13 8

9 B 6 8 12 5

10 B 5 7 11 9

;

RUN;

PROC PRINT DATA = temp ;

RUN;

PROC GLM DATA = temp;

CLASS group;

MODEL r1-r4 = group / NOUNI ;

REPEATED trial 5;

RUN;

When the above code is executed, we get the following result −

sas 5

So, this brings us to the end of blog. This Tecklearn ‘Fishers Exact Tests and Repeated Measure Analysis in SAS’ blog helps you with commonly asked questions if you are looking out for a job in SAS. If you wish to learn SAS and build a career in Data Analytics domain, then check out our interactive, SAS Training for SAS BASE Certification Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

SAS Training for SAS BASE Certification

SAS Training for SAS BASE Certification Training

About the Course

SAS Certification Training is intended to make you an expert in SAS programming and Analytics. You will be able to analyse and write SAS code for real problems, learn to use SAS to work with datasets, perform advanced statistical techniques to obtain optimized results with Advanced SAS programming. In this SAS online training course, you will also learn SAS macros, Machine Learning, PROC SQL, procedure, statistical analysis and decision trees. You will also work on real-life projects and prepare for the SAS Certified Base Programmer certification exam. Upon the completion of this SAS online training, you will have enough proficiency in reading spreadsheets, databases, using SAS functions for manipulating this data and debugging it.

Why Should you take SAS Training?

• The average salary for a Business Intelligence Developer skilled in SAS is $100k (PayScale salary data)

• SAS, Google, Facebook, Twitter, Netflix, Accenture & other MNCs worldwide are using SAS for their Data analysis activities and advance their existing systems.

• SAS is a Leader in 2017 Gartner Magic Quadrant for Data Science Platform.

What you will Learn in this Course?

Introduction to SAS

• Introduction to SAS

• Installation of SAS

• SAS windows

• Working with data sets

• Walk through of SAS windows like output, search, editor etc

SAS Enterprise Guide

• How to read and subset the data sets

• SET Statement

• Infile and Infile Options

• SAS Format -Format Vs Informat

SAS Operators and Functions

• Using Variables

• Defining and using KEEP and DROP statements

• Output Statement

• Retain Statement

• SUM Statement

Advanced SAS Procedures

• PROC Import

• PROC Print

• Data Step Vs Proc

• Deep Dive into Proc

Customizing Datasets

• SAS Arrays

• Useful SAS Functions

• PUT/INPUT Functions

• Date/Time Functions

• Numeric Functions

• Character Functions

SAS Format and SAS Graphs

• SAS Format statements

• Understanding PROC GCHART, various graphs, bar charts: pie, bar

Sorting Techniques

• NODUP

• NODUKEY

• NODUP Vs NODUKEY

Data Transformation Function

• Character functions, numeric functions and converting variable type

• Use functions in data transformation

Deep Dive into SAS Procedures, Functions and Statements

• Find Function

• Scan Function

• MERGE Statement

• BY Statement

• Joins

• Procedures Vs Function

• Where Vs If

• What is Missover

• NMISS

• CMISS

PROC SQL

• SELECT statement

• Sorting of Data

• CASE expression

• Other SELECT statement clauses

• JOINS and UNIONS

Using SAS Macros

• Benefits of SAS Macros

• Macro Variables

• Macro Code Constituents and Macro Step

• Positional Parameters to Macros

Got a question for us? Please mention it in the comments section and we will get back to you.

 

 

 

 

 

 

 

0 responses on "Fishers Exact Tests and Repeated Measure Analysis in SAS"

Leave a Message

Your email address will not be published. Required fields are marked *