<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic why my ssum didn't accumlate previous sum in FCMP? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41867#M8600</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how do I fix it then? retain statement has no effect in the fcmp function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reeza, it does look like a NPV issue, but it is acutally bootstrapping the zero curve rate. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Feb 2012 06:51:28 GMT</pubDate>
    <dc:creator>ZRick</dc:creator>
    <dc:date>2012-02-01T06:51:28Z</dc:date>
    <item>
      <title>why my ssum didn't accumlate previous sum in FCMP?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41863#M8596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I defined a function in fcmp, use ssum to accumulate previous result, initial value is 0, but it didn't take any effect.&lt;/P&gt;&lt;P&gt;When you run the data step in following code, the unsifted_t is the same as unshifed, but it should be same as unshifted_spot_result.&lt;/P&gt;&lt;P&gt;I really need this function to go through other variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data unshifted_t;&lt;/P&gt;&lt;P&gt;input &lt;/P&gt;&lt;P&gt;Years&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Unshifted Unshifted_spot_result;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;0.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.06&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.06&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0995&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.099509828&lt;/P&gt;&lt;P&gt;1.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.114&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.114015775&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.1285&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.128527322&lt;/P&gt;&lt;P&gt;2.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.17625&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.17636429&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.224&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.224255193&lt;/P&gt;&lt;P&gt;3.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.32975&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.330598452&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.4355&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.437295432&lt;/P&gt;&lt;P&gt;4.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.562&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.565505696&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.6885&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.694372675&lt;/P&gt;&lt;P&gt;5.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.806875&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.815596351&lt;/P&gt;&lt;P&gt;6&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.92525&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.937551696&lt;/P&gt;&lt;P&gt;6.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.043625&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.060324593&lt;/P&gt;&lt;P&gt;7&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.162&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.184005865&lt;/P&gt;&lt;P&gt;7.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.242833333&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.268562214&lt;/P&gt;&lt;P&gt;8&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.323666667&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.353681835&lt;/P&gt;&lt;P&gt;8.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.4045&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.43941207&lt;/P&gt;&lt;P&gt;9&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.485333333&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.525802656&lt;/P&gt;&lt;P&gt;9.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.566166667&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.612905958&lt;/P&gt;&lt;P&gt;10&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.647&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.70077724&lt;/P&gt;&lt;P&gt;10.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.7015&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.759653469&lt;/P&gt;&lt;P&gt;11&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.756&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.819015077&lt;/P&gt;&lt;P&gt;11.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.8105&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.878885836&lt;/P&gt;&lt;P&gt;12&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.865&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.939291582&lt;/P&gt;&lt;P&gt;12.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.900666667&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.978108796&lt;/P&gt;&lt;P&gt;13&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.936333333&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.017278596&lt;/P&gt;&lt;P&gt;13.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.972&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.056807704&lt;/P&gt;&lt;P&gt;14&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.007666667&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.096704449&lt;/P&gt;&lt;P&gt;14.5&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.043333333&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.136978638&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.079&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.177641474&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc fcmp outlib=work.ftn.krd;&lt;/P&gt;&lt;P&gt;function OSSC(in);&lt;/P&gt;&lt;P&gt;ssum= 0;&lt;/P&gt;&lt;P&gt;do i = 1 to 60;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; llatest = 0.5 * (in) / 100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; spot_llatest1 = (1 - llatest*ssum) / (1 + llatest);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ssum+spot_llatest1; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; spot_llatest2 = Exp(-Log(spot_llatest1)/i) - 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; spot_llatest3=spot_llatest2*100*2; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(spot_llatest3);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;endsub;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data OSSC;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set unshifted_t; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unshifted_s = OSSC(Unshifted);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format unshifted_s 10.8;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 05:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41863#M8596</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-01-31T05:52:03Z</dc:date>
    </item>
    <item>
      <title>why my ssum didn't accumlate previous sum in FCMP?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41864#M8597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; You are not letting your function loop as you are expecting.&amp;nbsp; By having the return function inside your do loop you are cuaseing it to prematurely end the computation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 18:44:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41864#M8597</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-01-31T18:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: why my ssum didn't accumlate previous sum in FCMP?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41865#M8598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I may have made a mistake but the logic inside the code is set to return 0 for an input of 0 so you may have some logic issues, take a look at your definition of llatest which will always resolve to the same value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It also looks like a NPV or bi-annual interest accumulation function and there should be a closed form or some other SAS function that might get you there easier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 18:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41865#M8598</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-01-31T18:52:17Z</dc:date>
    </item>
    <item>
      <title>why my ssum didn't accumlate previous sum in FCMP?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41866#M8599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I agree with Reeza that the function itself does not appear to have a purpose.&amp;nbsp; The return value will always equal the input value because of the mathmatical logic employed.&amp;nbsp; Since I am unaware of what you are attempting to calculate I chose to just point out the syntactical error in your function, but you should probably consider also checking your calculations logic as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 19:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41866#M8599</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-01-31T19:51:44Z</dc:date>
    </item>
    <item>
      <title>why my ssum didn't accumlate previous sum in FCMP?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41867#M8600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how do I fix it then? retain statement has no effect in the fcmp function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reeza, it does look like a NPV issue, but it is acutally bootstrapping the zero curve rate. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2012 06:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41867#M8600</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-02-01T06:51:28Z</dc:date>
    </item>
    <item>
      <title>why my ssum didn't accumlate previous sum in FCMP?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41868#M8601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe the zero-coupon yield curve can be calculated using the yieldp function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1 style="font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; color: #003399; font-size: 20px; margin-bottom: 8px; margin-top: -1em; background-color: #ffffff;"&gt;&lt;/H1&gt;&lt;H1 style="font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; color: #003399; font-size: 20px; margin-bottom: 8px; margin-top: -1em; background-color: #ffffff;"&gt;&lt;A name="a001123050" style="line-height: 1.25em; font-family: inherit;"&gt;YIELDP Function&lt;/A&gt;&lt;/H1&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-weight: bold; background-color: #ffffff;"&gt;Returns the yield-to-maturity for a periodic cash flow stream, such as a bond.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001123050.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001123050.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2012 08:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-ssum-didn-t-accumlate-previous-sum-in-FCMP/m-p/41868#M8601</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-02-01T08:51:39Z</dc:date>
    </item>
  </channel>
</rss>

