Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: question on looping


From   Aaron Li <[email protected]>
To   [email protected]
Subject   Re: st: question on looping
Date   Wed, 12 Oct 2005 18:34:51 -0500

Hi Kit and others,

For my purpose, I need the st dev for each id for the past five years.
Let's say id 18 as a firm makes two investments in two different
industries in year 1998 (summing them up may not be ideal in this
case). I am not as interested in computing the st dev 'over time' for
id 18 as in the st dev of its investments for the past five years.
This sounds like a 'repetitive' task but I am not an exerpienced Stata
programmer to figure out a solution.

Here is a sample of the dataset again:

id year var1
18 1993 5.684
18 1993 18.80
18 1994 6.482
18 1996 5.99
18 1998 9.887
18 1998 78.52
27 2000 53.51
41 1983 1.969
71 1997 9.216
74 1995 1.758
74 1997 9.501
74 2001 15.89

Thanks,    Aaron

On 10/12/05, Kit Baum <[email protected]> wrote:
> Aaron wrote
>
> Thanks so much! My dataset, however, not only have time gaps but also
> may have more than one observation for a single time period. I cannot
> sum them up. What can I do in this case?
>
> I don't understand how a given ID has more than one value of var1 in
> year t, unless they are being measured more frequently than annually
> or there are competing measurements (e.g. multiple forecasters for
> the same firm's returns). Your problem is well defined if you have
> time series organized in a panel. With gaps, it becomes more
> problematic. But with multiple measurements for a given (i,t), I
> don't know what it is telling you, or what it means to compute a
> std.dev. of the series "over time".
>
> Kit Baum, Boston College Economics
> http://ideas.repec.org/e/pba1.html
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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