%macro Fact(_inFact,_outfact); /**************************************************************************************/ /* _inFact = is a whole number that is the number of elements from which the */ /* factorial is computed. (REQUIRED) */ /* _outFact = the returned Factorial value. */ /* */ /* Name: Fact.SAS */ /* Data: Sourced from MineQuest, LLC. Auth: Phil Rack */ /* Date: 5/15/2007 Revd: */ /* */ /* Copyright (C) 2007 by MineQuest, LLC. All Rights Reserved. */ /**************************************************************************************/ if (&_infact le 0) or (&_infact eq .) then do; &_outfact = .; end; else do; _counter = &_infact; _Fact = 1; Do while (_counter > 0); _fact = _fact * _counter; _counter + -1; End; &_outfact = _fact; drop _counter _fact; End; /********************************************************************************************/ /* FACT 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 Fact;