Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* counts n_i*/
- proc sql;
- create table counts as
- select n_i, count(n_i) as n
- from have
- group by n_i;
- quit;
- /* total n */
- proc sql;
- create table total as
- select distinct n_i, count(n_i) as nt
- from have;
- quit;
- /* number of categories c */
- proc sql noprint;
- select count(distinct n_i) into: c
- from have;
- quit;
- %put c = &c.; /* number of categories */
- %let a = 0.05; /* alpha */
- data Goodman;
- merge counts total;
- by n_i;
- length lcl 8; /* lower confidence limits */
- length ucl 8; /* upper confidence limits */
- p = n/nt; /* percentages */
- x = cinv(1-&a/&c,1); /* chi-square quantile, df=1, with Bonferroni adjustment */
- lcl = (x + 2*n - sqrt(x*(x + 4*n*(nt - n)/nt)))/(2*(nt + x));
- ucl = (x + 2*n + sqrt(x*(x + 4*n*(nt - n)/nt)))/(2*(nt + x));
- run;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement