BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASuserJP
Calcite | Level 5

I would like to perform exact Cochran-Armitage test.

I followed this programming. (https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_code_freqex8.htm&docsetVersion=14...)

It worked and I obtained the P-value of 0.0288 (asymptotic test, two-sided).

However, no P-value under the exact test, even though my code contains "exact trend".

I would be very grateful if you could please show me the correct programming for this. 

Thank you for your help. 

 

data try;
input year ama$ count @@;
datalines;
2005 YES 33 2005 NO 77
2006 YES 41 2006 NO 113
2007 YES 42 2007 NO 102
2008 YES 53 2008 NO 210
2009 YES 69 2009 NO 246
2010 YES 78 2010 NO 275
;
ods graphics on;
proc freq data=try;
tables ama*year / trend measures cl
plots=mosaicplot;
test smdrc;
exact trend / maxtime=60;
weight Count;
title 'armitage test';
run;
ods graphics off;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Exact statistics require counting the number of possible tables that satisfy a condition. The p-value requires counting how many possible tables are more extreme than the given one.  This can be a very long computation. According to the documentation, when you use the MAXTIME=60 option, you are telling SAS to compute the p-values in 60 seconds or else give up. Apparently the p-values for your data (which have high counts) require more than 60 seconds. 

 

So decide how long you want to wait and increase the MAXTIME. For example, MAXTIME=600 will wait 10 minutes. If you still don't get an answer, use the MC option on the EXACT statement, which will give an approximate p-value by using Monte Carlo methods.

 

 

 

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Exact statistics require counting the number of possible tables that satisfy a condition. The p-value requires counting how many possible tables are more extreme than the given one.  This can be a very long computation. According to the documentation, when you use the MAXTIME=60 option, you are telling SAS to compute the p-values in 60 seconds or else give up. Apparently the p-values for your data (which have high counts) require more than 60 seconds. 

 

So decide how long you want to wait and increase the MAXTIME. For example, MAXTIME=600 will wait 10 minutes. If you still don't get an answer, use the MC option on the EXACT statement, which will give an approximate p-value by using Monte Carlo methods.

 

 

 

SASuserJP
Calcite | Level 5
Thank you so much!

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 619 views
  • 2 likes
  • 2 in conversation