%macro run_fishers (version, data=, row=, col=, count=); %let _version=1.0; %if &version ne %then %put RUN_FISHERS macro Version &_version; %let opts = %sysfunc(getoption(notes)) _last_=%sysfunc(getoption(_last_)); %if &version ne debug %then %str(options nonotes;); /* Check for newer version */ %if %sysevalf(&sysver >= 8.2) %then %do; %let _notfound=0; filename _ver url 'http://ftp.sas.com/techsup/download/stat/versions.dat' termstr=crlf; data _null_; infile _ver end=_eof; input name:$15. ver; if upcase(name)="&sysmacroname" then do; call symput("_newver",ver); stop; end; if _eof then call symput("_notfound",1); run; %if &syserr ne 0 or &_notfound=1 %then %put &sysmacroname: Unable to check for newer version; %else %if %sysevalf(&_newver > &_version) %then %do; %put &sysmacroname: A newer version of the &sysmacroname macro is available.; %put %str( ) You can get the newer version at this location:; %put %str( ) http://support.sas.com/ctx/samples/index.jsp; %end; %end; proc freq data=&data noprint; %if &count ne %then %str(weight &count / zeros;); tables &row*&col / sparse outexpect out=_out1; run; proc means data=_out1 noprint; var count; output out=_out2; run; data _null_; set _out1; if expected<=5 then warn+1; if _n_=1 then set _out2; pct_lt5=warn/_freq_; if _freq_=_n_; warning=(pct_lt5>=.2); call symput('warning',warning); run; options &opts; proc freq data=_out1; weight count / zeros; tables &row*&col / chisq; %if &warning=1 %then %do; exact fisher; %end; run; %mend;