BookmarkSubscribeRSS Feed
IsaacNakamura
Fluorite | Level 6

I use SAS9.4.

 

I would like to do a exact analysis of s by r table where

the covariate is nominal and the response is ordinal.

Also this is an analysis of categorical data, so we observe the frequency of each covariate*response level.

 

So the data should look something like

 

data example;

input covariate $ response $ count @@;

datalines;

cov1 bad 3 cov1 moderate 4 cov1 good 0

cov2 bad 4 cov2 moderate 1 cov2 good 2

cov3 bad 5 cov3 moderate 2 cov3 good 1 

;

 

The sample size is quite small, so I would like to use exact analysis.

 

I suppose I can do something like  

 

froc freq order=data;

weight count;

tables covariatename*outcomename / exact

run;

 

But, this should give just a general association, not a "mean score differ" type of result.

What kind of option can I use to do this exact analysis?

 

Thank you for your help in advance.

 

 

 

6 REPLIES 6
ballardw
Super User

To do anything with "difference" I think you need your responses to be numeric. I think you might investigate Proc Npar1way.

 

proc format library=work;
   invalue response
   'bad' = 1
   'moderate'=2
   'good' =3;
run;
data example;
   informat response response.;
   input covariate $ response  count @@;
datalines;
cov1 bad 3 cov1 moderate 4 cov1 good 0
cov2 bad 4 cov2 moderate 1 cov2 good 2
cov3 bad 5 cov3 moderate 2 cov3 good 1 
;
run;

proc npar1Way data=example;
   class covariate;
   freq count;
   var response;
   exact Wilcoxon;
   
run;
Ksharp
Super User

Friedman’s Chi-Square Test can get "mean score differ" , Check example in Documentation.

 

proc freq data=Hypnosis;
tables Emotion * SkinResponse /cmh2 scores=rank noprint;

exact ..... ;
run;

 

OR You could try PROC CATMOD ,which is the best tool to build a Log-Linear Model for Contingency Table.

 

 

Rick_SAS
SAS Super FREQ

For an overview of the various exact tests in PROC FREQ, see "Exact tests in PROC FREQ: What, when, and how."

 

The PROC FREQ doc says "The Jonckheere-Terpstra test is appropriate for a two-way table in which an ordinal column variable represents the response."

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1647 views
  • 3 likes
  • 4 in conversation