我如何构建SAS循环以获取要付款的数量?

发布于 2025-01-22 15:00:19 字数 1605 浏览 2 评论 0原文

希望你能帮我。

下表希望通过使用SAS代码来显示我想获得的结果。 基本上,这是关于计算分期付款的数量,从10.000欧元开始,为10年的利率为6%,在每个时期结束时支付固定分期付款。

fiele_installment758,68兴趣capital_paidloan_paidto_be_paid
11.358,68600,00758,689.241,32
2758,68
1.358,68€ ,68欧元506,23€852,45€2.415,33€7.584,67€
1.358,68455,083.318,93€3.318,936.681,07
4欧元903,60 ,82欧元4.276,75€5.723,25€
61.358,68€343,40€1.015,28€5.292,03€4.707,97€
71.358,68€71.358,68282,48 ,77€
81.358,68€217,91€1.140,77€7.509,01€2.490,99€
1.358,68欧元149,46欧元1.209,228.718,23€
98.718,2376,91欧元1.281,77€10.000,00€0,00€0,00欧元

的利息是通过将6%的利率乘以PAR_VALUE获得的;

Capital_paid是分期付款和给定年份支付的利息之间的差额。

Loan_paid是每年获得付款的资本部分的总和。

TO_BE_PAID是支付在给定年份的资本之间的差额(第一排第一年的价值为10000-1358,68)。

hope you can help me.

The below table wants to show the result I want to get by using a sas code.
Basically, it's about calculating the amount of an installment, starting from par_value of 10.000€, with 6% interest rate for 10 years, paying a fixed installment at the end of each period.

yearfixed_installmentinterestscapital_paidloan_paidto_be_paid
11.358,68 €600,00 €758,68 €758,68 €9.241,32 €
21.358,68 €554,48 €804,20 €1.562,88 €8.437,12 €
31.358,68 €506,23 €852,45 €2.415,33 €7.584,67 €
41.358,68 €455,08 €903,60 €3.318,93 €6.681,07 €
51.358,68 €400,86 €957,82 €4.276,75 €5.723,25 €
61.358,68 €343,40 €1.015,28 €5.292,03 €4.707,97 €
71.358,68 €282,48 €1.076,20 €6.368,23 €3.631,77 €
81.358,68 €217,91 €1.140,77 €7.509,01 €2.490,99 €
91.358,68 €149,46 €1.209,22 €8.718,23 €1.281,77 €
101.358,68 €76,91 €1.281,77 €10.000,00 €0,00 €

interests is obtained by multiplying the 6% interest rate per the par_value;

capital_paid is the difference between the installment and the interest paid for a given year.

loan_paid is the sum of the parts of the capital each year that got paid.

to_be_paid is the difference between the capital to pay at given year minus the capital_paid (the value of the first year in the first row is 10000-1358,68).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放我走吧 2025-01-29 15:00:19

你尝试了什么?

我可以提出这样的建议:

data test;
    attrib year par_value fixed_installment interest_rate interest capital_paid loan_paid to_be_paid format=best.;
    
    *-- Initial values --*;
    par_value = 10000;  
    fixed_installment = 1358.68;
    interest_rate = 0.06;
    loan_paid = 0;
    
    *-- Loop through 10 years --*;
    do year = 1 to 10;
        *-- Calculate interests --*;
        interest = round((par_value - loan_paid) * interest_rate, 0.01);
        
        *-- Calculate capital paid --*;
        capital_paid = fixed_installment - interest;
        
        *-- Calculate loan paid --*;
        loan_paid = loan_paid + capital_paid;
        
        *-- Calculate remaining loan --*;
        to_be_paid = par_value - loan_paid;
        
        output;
    end;
run;

What did you tried?

I can propose something like this:

data test;
    attrib year par_value fixed_installment interest_rate interest capital_paid loan_paid to_be_paid format=best.;
    
    *-- Initial values --*;
    par_value = 10000;  
    fixed_installment = 1358.68;
    interest_rate = 0.06;
    loan_paid = 0;
    
    *-- Loop through 10 years --*;
    do year = 1 to 10;
        *-- Calculate interests --*;
        interest = round((par_value - loan_paid) * interest_rate, 0.01);
        
        *-- Calculate capital paid --*;
        capital_paid = fixed_installment - interest;
        
        *-- Calculate loan paid --*;
        loan_paid = loan_paid + capital_paid;
        
        *-- Calculate remaining loan --*;
        to_be_paid = par_value - loan_paid;
        
        output;
    end;
run;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文