%macro LoanPrin(_mqrlpr,_mqilpr,_mqylpr,_mqnlpr, _mqplpr); /**************************************************************************************/ /* Name: LoanPrin.sas Auth: Phil Rack */ /* Date: 5/16/2007 Revd: */ /* */ /* Desc: Calculates the Principal on a loan. */ /* */ /* Where: _mqplpr = The loan principal. (The returned value) */ /* _mqilpr = The loan interest rate. */ /* _mqylpr = The loan term in years. */ /* _mqnlpr = The loan term in months. */ /* _mqrlpr = The calculated loan payment. */ /* */ /* Copyright (C) 2007 by MineQuest, LLC. All Rights Reserved. www.minequest.com */ /**************************************************************************************/ if (%length(%str(&_mqilpr)) eq 0) or (&_mqilpr = '.') or (%length(%str(&_mqylpr)) eq 0) or (&_mqylpr = '.') or (%length(%str(&_mqrlpr)) eq 0) or (&_mqrlpr = '.') or (%length(%str(&_mqnlpr)) eq 0) or (&_mqnlpr = '.') then do; &_mqplpr = .; End; Else Do; &_mqplpr = &_mqrlpr * &_mqnlpr * (1-1/(( &_mqilpr / 100) / &_mqnlpr + 1) ** (&_mqnlpr * &_mqylpr)) / (&_mqilpr / 100); End; /********************************************************************************************/ /* LoanPrin 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 LoanPrin;