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, is already up and running.

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

st: re:

From   Kit Baum <>
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

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   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index