DURATION Function
calculates and returns a scalar containing the modified duration of
a noncontingent cashflow.
The Duration function returns the modified duration of a noncontingent
cashflow as a scalar.
 times
 is an ndimensional column vector of times.
Elements should be nonnegative.
 flows
 is an ndimensional column vector of cashflows.
 ytm
 is the perperiod yieldtomaturity of the
cashflow stream.
This is a scalar and should be positive.
Duration of a security is generally defined as:

D = [( [dP/P] )/ dy ]
In other words, it is the relative change in price for a unit change
in yield. Since prices move in the opposite direction to yields,
the sign change preserves positivity for convenience. With cashflows
that are not yieldsensitive and the assumption of
parallel shifts to a flat termstructure, duration is given by:
where P is the present value,
y is the per period effective yieldtomaturity,
K is the number of cashflows, the kth
cash flow being c(k), t_{k} periods from the present.
This measure is referred to as modified duration to
differentiate it from the first duration measure ever proposed,
Macaulay duration:
This expression also reveals the reason for the name duration, since
it is a presentvalueweighted average of the duration (i.e. timing) of
all the cashflows and is hence an "average timetomaturity" of the
bond.
Example
proc iml;
times=1;
ytm=.1;
flow=10;
duration=duration(times,flow,ytm);
print duration;
quit;
DURATION
0.9090909
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.