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.
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;
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.
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."
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.