CPI would lend itself to a look-up based on the "prevailing index value" at a date.
That way you don't need a date match between annual account data and cpi-data.
I assume an index value at date X applies for annual accounts dated between date-at(X) and date-at(X-1). Proc format allows us to create a look-up file of this nature.
Additionally, you have more than one ratio. Are these for different values or as at different dates?
Here is some code to build a demo look-up file[pre]data c_price_data ;
infile cards dsd;
input date index ;
informat date date9. ;
list;cards;
31dec1999, 100.1
31dec2000, 105.2
31dec2005, 115.34
31dec2007, 119.456
31dec2009, 120.7890123
;
data cntlin ;
retain fmtname 'cpi' hlo 'L' start end ;
set c_price_data( keep= date index ) end= eof ;
end = date ;
label = index ;
output ;
hlo = ' ' ;
start = end ;
if eof ;
hlo = 'H' ;
output ;
run ;
proc format cntlin= cntlin fmtlib ;
run ;
*demo ;
%put demo %sysfunc( putn( "1jan1990"d, cpi ));
%put demo %sysfunc( putn( "1Mar2000"d, cpi ));
%put demo %sysfunc( putn( "1Aug2008"d, cpi ));
%put demo %sysfunc( putn( "1Aug2010"d, cpi ));[/pre]
One wrinkle - the put() function creates character values, not numerics. So the formula to collect the index value and apply it, involves a conversion of the character version of the index to a number. Something like[pre] data deflated ;
set raw_returns( keep= companyID return_date balance1-balance8 ) ;[/pre]* assuming the company information is stored in variables like balance1 ... balance8 .. .. .. adapt to suit ;[pre] cpi = input( put( return_date, cpi11. ), best11. ) ;[/pre]* with my demo index values, we need also to divide by 100 ;[pre] cpi= cpi/100 ;
array balances(*) balance1-balance8 ;
do idx= 1 to dim(balances) ;
if balances(idx) then balances(idx)= balances(idx) / cpi ;
end ;
run ;[/pre]
For 3% percentile boundaries, I think you'll find proc univariate most convenient, as it allows you to specifiy whatever percentiles you want.
Happy reading of the manual
PeterC
CPI not RPI message was edited by: Peter.C