Statalist


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

st: RE: Intraday volatility


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: Intraday volatility
Date   Mon, 7 Dec 2009 19:08:47 +0100

<>

Not sure what you mean. -by()- will happily take the string for the "Date",
but you can also convert it to numeric:


*******
clear*

input str10 Date   return byte  id
"02/01/2009"      .0003247        1
"02/01/2009"           .005724         2
"02/01/2009"            .0001587       3
"03/01/2009"      .0000997        1
"03/01/2009"                 .0002494       2
"03/01/2009"              .000071          3
"05/01/2009"      .0001245        1
"05/01/2009"            .00015879      2
"05/01/2009"             .0003546       3
end

compress

gen date=date(Date, "DMY")
format date %tdMonth_DD,_CCYY

egen st=sd(return), by(date)
list, noo
*******


HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Beatrice Crozza
Sent: Montag, 7. Dezember 2009 19:01
To: [email protected]
Subject: st: Intraday volatility

Dear all,

(sorry for the previous posting)

these are my data:

Date                  return          id
02/01/2009      .0003247        1
                       .005724         2
                       .0001587       3

03/01/2009      .0000997        1
                       .0002494       2
                      .000071          3

05/01/2009      .0001245        1
                      .00015879      2
                      .0003546       3

I would like to compute the intraday volatility, i.e. the volatility
for each day divided by the id.
I typed:
egen st=sd(return), by (id)

but I don't know how to insert also the date, so that I can compute
the intraday volatility.

Could you help me please?

Thanks,
Bea
*
*   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/

*
*   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