10-30-2012 09:58 AM
tI found some examples on coding the actual Fisher index on SAS website:
idxf_p = sqrt((laspeyres_price_index(p0, q0, pn)* paasche_price_index(p0, pn, qn)));
return( idxf_p );
I am using a long time series of quarterly data and would like to chain annually. I know I can compute idxf_p for every pair of quarters (--> the relative indices) and then multiply every four data points (relatives) to get the annual chained index, but I am wondering if there is a simple (more efficient) way to 1) get the relative indices for every pair of data points and 2) chain the index. In other words, is there a way to make SAS 1) create new variables (or new dataset) for the relative quarterly indices and 2) create a new variable (annual index) automatically by multiplying every 4 data points in the dataset?
10-30-2012 06:23 PM
Creating new variables and tables in SAS is a cinch. Assuming, as you say, you can calculate the quarterly Fisher index (ie the formula works and the input parameters are already in your quarterly data, I suggest the easiest route is the LAG function to store previous quarter values.
Note that the lag functions must be inserted after the current index has been evaluated.
Here is an outline. This will give running annual index values.
Data want ;
Set have ;
/* Calculate Fisher index for the quarter */
idxf_p_qtr = sqrt(...) ;
idxf_p1 = LAG(idxf_p_qtr) ;
idxf_p2 = LAG(idxf_p1) ;
idxf_p3 = LAG(idxf_p2) ;
idxf_p_ann = idxf_p_qtr * idxf_p1 * idxf_p2 * idxf_p3 ;
Drop idxf_p1 idxf_p2 idxf_p3 ;
Richard in Oz