## How to calculate seasonally adjusted asset growth rate for quarterly data???

Occasional Contributor
Posts: 10

# How to calculate seasonally adjusted asset growth rate for quarterly data???

I need to create a variable to caputure firm-level seasonally adjusted asset growth rate volatility . I use the following to code to capture the volatility ( I didn't adjust seasonal factor). Can someone let me know if this code is ok or there is some better code to do it?? Also, could someone let me know how to seasonally adjusted the volatility?? I have no clue.

proc sort data=HAVE;
by company_ID date_quarterly;
run;
proc expand data=HAVE out=WANT method=none;
convert asset_growthrate=asset_growthrate_std / transformout=(movstd 8);
by company_ID;
run;

Posts: 1,294

## Re: How to calculate seasonally adjusted asset growth rate for quarterly data???

[ Edited ]

You have in effect three variables (asset_growthrate_std, company_id date_quarterly, with four records per company_id/year, sorted by company_id/date_quarterly.  The question is what sample do you want to use for determining seasonality?  (1) Do you want to use your entire date range?

I'm going to assume that (1) you're going to use your entire sample of companies over all your sample date range (I'll assume 1981 through 2010, i.e. 30 year ==> 120 quarters).  And I'll assume that you'll be interested in the seasonality indexes averaged over all the years - i.e. each year is weighted equally.  And since the item of interest is a rate, I'll assume all companies are equally weighted for each yearly result.

This program does that:

Notes:

1. The two dimension array QSUMS has a row for each year from 1981 to 2010, and a column for each quarter.  It gets the total asset_growthrate over all companies for the given year/quarter.
2. The program assumes that for each year, a company's quarterly data are complete.  I.e. a company may have data just for some years, but for those years in which it is present, it has data for all 4 quarters.
3. Note this program makes no assumptions about year-to-year trends.
4. The DIM(qsums,1) says to get the size of the first dimension of the qsums array, i.e. the number of rows in the array.

``````
data want (keep=seasonal_index1-seasonal_index4);
set have end=end_of_have;

array qsums{1981:2010,1:4} _temporary_ (120*0);

qsums{year(date_quarterly),qtr(date_quarterly)}+asset_growthrate;

/* Get average over years of quartely shares*/
array seasonal_index {4} seasonal_index1-seasonal_index4 (4*0);
if end_of_have then do;
do year=1981 to 2010;
yearly_total=sum(qsums{year,1},qsums{year,2},qsums{year,3},qsums{year,4});
do q=1 to 4;
seasonal_index{q}=seasonal_index{q} + qsums{year,q}/(yearly_total/4);
end;
end;
do q=1 to 4;
seasonal_index{q}=seasonal_index{q}/dim(qsums,1);
end;
output;
end;
run;``````

Regards,

Mark

And (editted later) here's how to use the index to get adjusted rates (i.e. what the yearly rate would be based on a seasonally-adjusted modification of the observed quarterly rate:

``````data adjusted_rates (drop=seasonal_index1-seasonal_index4);

if _n_=1 then set want;
array seasonal_index {4} seasonal_index1-seasonal_index4;

set have;