There are a couple of functions(NPV, NETPV) in SAS .
NETPV(
r,
freq,
c0,c1,...,cn)
NPV(
r,
freq,
c0,c1,...,cn)
It is convenient if the cashflows are uneven for each period.
When the cashflows are the same for each period. You can use the mort function.
Here is an example. Suppose that monthly cashflow is 7000, annual intest rate is 7% and period=30 years.
The present value=1052152.9756 ~1 million. Or in other words your monthly payment is 7000 when you borrow 1 million yuan from a bank with a contract of 7% and 30 years to buy a house. A morgage payment is usually below 1/3 of your income. So you need a yearly salary 7000*3*12 ~250000 Yuan; otherwise renting a house is a better choice.
30
31 data _null_;
32 npv=1000000;
33 rate=0.07; *annual intest rate;
34 term=12*30;*30 years;
35 npv=mort(.,7000,rate/12,term);
36 put npv=;
37 run;
npv=1052152.9756
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds