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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: re:


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: re:
Date   Sun, 7 Feb 2010 16:11:03 -0500

<>	
Mark writes:

Anything conceptually wrong with my commands ?
>>
. sum

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        date |     32494     14804.6    105.3298      14640      14973
      permno |     32494    65554.46    23142.46      10051      92866
         ret |     32494    .0081212    .1509227  -.8353909          3

. reshape wide permno, i(date) j(ret)
ret takes on too many values
r(134);

Yes, there is something conceptually wrong. You have long-format data in which each ret is indexed by firm (permno) and date. You want wide-format data of time series, one per firm. Therefore the 'j' variable is permno, not ret.

reshape wide ret, i(date) j(permno)

would make sense. So would

reshape wide ret, i(permno) j(date) 

which would create cross-sections per date in each variable. But ret is what you are trying to reshape, not the index of either of its dimensions.

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html


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