Statalist


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

st: re: Date: Sun, 7 Feb 2010 21:41:16 +0100


From   Kit Baum <kitbaum@me.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: re: Date: Sun, 7 Feb 2010 21:41:16 +0100
Date   Sun, 07 Feb 2010 16:12:04 -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
kitbaum@me.com



*
*   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   |   What's new   |   Site index