Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Standard deviation of variable between dates


From   Joseph Monte <hmjc66@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: Standard deviation of variable between dates
Date   Tue, 14 Sep 2010 13:56:56 -0400

Hi Statalisters,

Based on the table below, I need the standard deviation of vwretd
between revfdate1[_n+1] (i.e. not including revfdate1) and offerdate1
while revfdate1[_n+`i']<=offerdate1, where i goes from 1 to 300
(basically the max length between revfdate1 and offerdate1 is 300).
So, using obs 23 as an example, I want the std dev of  -.00223069 and
.00704247. to be entered alongside obs 23 in a new variable. This new
variable should similarly contain all the resulting std deviations.
So, based on the table, there would be three std dev values ( obs 8,
14 & 23). I hope my explanation is clear.

      | revfdate1   offerdate1       vwretd |
      |------------------------------------|
   1. | 02jan1996           .    .00661722 |
   2. | 03jan1996           .   -.00014537 |
   3. | 04jan1996           .    -.0076854 |
   4. | 05jan1996           .   -.00103026 |
   5. | 08jan1996           .    .00268481 |
      |------------------------------------|
   6. | 09jan1996           .    -.0158739 |
   7. | 10jan1996           .   -.01555297 |
   8. | 11jan1996   20mar1996    .00843481 |
   9. | 12jan1996           .   -.00099131 |
  10. | 15jan1996           .    -.0052766 |
      |------------------------------------|
  11. | 16jan1996           .    .01000137 |
  12. | 17jan1996           .   -.00052036 |
  13. | 18jan1996           .    .00378893 |
  14. | 19jan1996   07feb1996     .0056981 |
  15. | 22jan1996           .    .00429229 |
      |------------------------------------|
  16. | 23jan1996           .   -8.435e-06 |
  17. | 24jan1996           .    .01023512 |
  18. | 25jan1996           .   -.00367997 |
  19. | 26jan1996           .    .00624507 |
  20. | 29jan1996           .    .00404597 |
      |------------------------------------|
  21. | 30jan1996           .    .00915902 |
  22. | 31jan1996           .    .00800156 |
  23. | 01feb1996   05feb1996    .00463789 |
  24. | 02feb1996           .   -.00223069 |
  25. | 05feb1996           .    .00704247 |
      |------------------------------------|
  26. | 06feb1996           .    .00684131 |
  27. | 07feb1996           .    .00349892 |
  28. | 08feb1996           .    .00772813 |


Thanks,

Joe
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index