%MACRO ProbF( _fscore, _df1, _df2, _probfval); /**************************************************************************************/ /* Name: ProbF.sas Auth: Phil Rack */ /* Date: 5/16/2007 Revd: */ /* */ /* Desc: Calculates the Percentile values for a given F distribution curve. */ /* */ /* Where: _fscore = is the f-Value to be tested. */ /* _df1 = is the degrees of freedom in the numerator. */ /* _df2 = the degrees of freedom in the denominator. */ /* _ProbFval = The calculated Probability of F (the returned value.) */ /* */ /* Copyright (C) 2007 by MineQuest, LLC. All Rights Reserved. www.minequest.com */ /**************************************************************************************/ IF (%length(%str(&_fscore)) eq 0) or (&_fscore = '.') OR (%length(%str(&_df1)) eq 0) or (&_df1 = '.') or (%length(%str(&_df2)) eq 0) or (&_df2 = '.') THEN DO; &_probfval = .; END; Else DO; _pfx = 1; IF &_fscore > 1 THEN DO; _pfs=&_df1; _pft=&_df2; _pfz=&_fscore; END; IF &_fscore LE 1 THEN DO; _pfs= &_df2; _pft= &_df1; _pfz = 1 / &_fscore; END; _pfj = 2/9/ _pfs; _pfk = 2 / 9 /_pft; _pfy = ABS(( 1 - _pfk) * _pfz**(1/3) - 1 + _pfj) / sqrt(_pfk*_pfz**(2/3) + _pfj); IF _pft GE 4 THEN DO; _pfx = .5/( 1 + _pfy*(.196854+_pfy*(.115194+_pfy*(.000344+_pfy*.019527))))**4; _pfx = INT(_pfx*100000+.5) / 100000; END; IF _pft LE 4 THEN DO; _pfy = _pfy* (1+.08*_pfy**4/_pft**3); _pfx = .5/(1+_pfy*(.196854+_pfy*(.115194+_pfy*(.000344+_pfy*.019527))))**4; _pfx = INT(_pfx * 100000+.5) / 100000; END; IF &_fscore >= 1 THEN &_probfval = 1 - _pfx; ELSE &_probfval=_pfx; DROP _pfs _pft _pfz _pfj _pfk _pfy _pfx; End; /******************************************************************************************/ /* ProbF is copyright (c) 2007 by MineQuest, LLC. All Rights Reserved. */ /* MineQuest, LLC, 1939 Queensbridge Dr., Columbus, OH USA. */ /* This Macro Program is proprietary software and is licensed property of MineQuest, LLC. */ /******************************************************************************************/ %MEND ProbF;