Check out -mvsumm- from SSC and see if it will help.
Nick
[email protected]
de la Garza, Adrian
> Anyone has an idea on how to do the following...?
>
> I have a dataset in panel format country-time, where time is given in
> monthly frequency. I need to take standard deviations of six-month
> periods within a same variable and then put the results in
> the following
> quarter. This is what I have:
>
> country year month quar xgrth
> Argentina 1990 1 1 .104022
> Argentina 1990 2 1 .1645495
> Argentina 1990 3 1 .5374349
> Bangladesh 1990 8 3 .2717893
> Bangladesh 1990 9 3 .3432341
> Bangladesh 1990 10 4 .2450083
> Bangladesh 1990 11 4 .1813706
> Bangladesh 1990 12 4 .1414036
>
> And what I need is to take the standard deviation by country and for
> every two consecutive quarters and store that number in the following
> quarter. So, eventually, I will convert the dataset given in monthly
> frequency (as shown) to quarterly frequency. I was thinking of taking,
> by country and for every row, the standard dev of the previous six
> observations, and then lag everything by three months and
> then collapse
> everything into quarters. But I don't know how to take the
> std devs...
>
> Something like this is what I could do, except that I know
> the -in- part
> is not syntactically correct:
>
> by country: egen stdev = sd(xgrth) in xgrth[_n-5]/xgrth
<<winmail.dat>>