Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Creating Standard Deviation variable for daily panel data (stock returns)


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Creating Standard Deviation variable for daily panel data (stock returns)
Date   Wed, 3 Jul 2013 17:43:49 +0100

I missed in this a statement of what you _do_ want. If you have a
block of values for which you calculate the SD, it's necessarily the
same result for all observations contributing.

But  Stata won't take account of missing values it does not have.

Nick
[email protected]

On 3 July 2013 17:37, C. Evans <[email protected]> wrote:

> I've been using the command egen sdreturn3 = sd(return), by(date) to try and
> create a new variable that takes the standard deviation of return for that
> month or even that day. This gives me the same sd for every id at that date
> (which I don't want)
>
> my panel looks like this
>
> id    date     returns
> 1   01Jan1964    0.1
> 1   02Jan1964    0.12
> 1   03Jan1964    0.05
> 2   01Jan1964    0.3
> 2   02Jan1964    0.25 2   03Jan1964    0.1
> 3   01Jan1964    -0.1
> 3   02Jan1964    -0.2
> 3   03Jan1964    -0.3
>
> Hopefully the format has turned out OK. The values are just there for an
> example.
>
> Also, does it matter when I use xtset, id date, daily that I am using
> business data and thereore the weekends are not included in my dataset
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index