BookmarkSubscribeRSS Feed
AndrewZ
Quartz | Level 8

When running Bin Chen's MKAPPA macro, I get an error, but I am not sure why.  Specifically I am wondering whether I am not using the macro correctly.

My data set is attached.  There are 13 raters who rated 320 subjects on a 4-point ordinal scale.  (This is after I removed subjects with only one rater.)

My code

%include "\path\to\mkappa.sas"; /* from http://www2.sas.com/proceedings/sugi30/155-30.pdf */

%let dloc = c:\temp;

%let dset = rating_smile_transposed ;

%let Nrater = 13;

%let Ncat = 4;

%let outfile = output.rtf ;

%mkappa;

The error

MPRINT(MKAPPA):   data kap.koutput;

MPRINT(MKAPPA):   set final;

MPRINT(MKAPPA):   keep Kappa SE pvalue;

MPRINT(MKAPPA):   Kappa=num/den;

MPRINT(MKAPPA):   SE=sqrt(2*(den*den-pqpsum))/(den*sqrt( 320*13*(13-1)));

MPRINT(MKAPPA):   pvalue=1-probnorm(kappa/se);

MPRINT(MKAPPA):   run;

NOTE: Invalid argument to function SQRT(-0.290557332) at line 34 column 174.

rate=4 x=188 xmx2=1914 p=0.0451923077 pq=0.043149963 pqp=0.0392498702 kj=0.111439652 numj=0.0048086169 num=0.0165537167 den=0.2357844859 pqpsum=0.20087299 Kappa=0.0702069801 SE=. pvalue=. _ERROR_=1 _N_=1

1 REPLY 1
ballardw
Super User

Proximate cause:

den=0.2357844859 pqpsum=0.20087299

sqrt (2* (den*den - pqpsum))

the den*den is calculated first with value in the .055 range. Subtract 0.200 and the result is negative.

It may be that some of your values are pushing the boundaries of what the macro was designed for but pqpsum has to be less than den*den to avoid this error.

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
  • 1 reply
  • 1571 views
  • 0 likes
  • 2 in conversation