Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Monthly observations to quarterly averages


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Monthly observations to quarterly averages
Date   Wed, 1 Jul 2009 13:40:05 -0400

David Musselwhite<[email protected]> :

See -help help dates_and_times- or try out:

sysuse sp500, clear
g qtr=qofd(date)
collapse open, by(qtr)
format qtr %tq
list

On Wed, Jul 1, 2009 at 1:32 PM, David
Musselwhite<[email protected]> wrote:
> Hi Statalisters,
>
> I have a dataset of unemployment rates by state by month and would like to
> convert these into quarterly averages, so I'd like to take the mean of every
> three observations and store it as a separate variable.
>
> AK  99   Oct     0
> AK  99   Nov   5
> AK  99   Dec   10
>
> would yield a value of 5, tied to that quarter. I'm imagining that collapse
> is the command I want to use, but am having trouble finding an example of
> this kind of process.
>
> Thanks for your help,
> David Musselwhite
> Cornell University

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index