Statalist


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

Re: st: Is anyone aware of the more efficient way to use reshape command


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: Is anyone aware of the more efficient way to use reshape command
Date   Wed, 08 Jul 2009 11:44:34 -0400

Hi.

Occasionally, I end up doing a virtual reshape without calling -reshape-. I do this, not for the reason that you cite, but it just works out that way in the way I approach a problem. In doing so, as with many other generalized programs, when you write the equivalent program tailored to your particular problem, it often ends up being more efficient and less space-needy.

For a reshape-long you would have a loop in which you...
use the basis dataset, keeping only the identifying variables and the content variable of your concern
 rename the content variable to a uniform name
 save the resulting dataset as a tempfile

Then in a separate loop...
 use the first of these tempfiles
 append the remaining tempfiles

HTH
Write back if you need further help with this method.
--David

P.S., be aware that going from wide to long can increase the size of the dataset, due to the replication of the identifying variables. You can make an estimate of the size of the reshaped dataset.

At 10:44 AM 7/8/2009, you wrote:
Hello all,

I have a relatively large panel data set 0.6GB and I am trying to
reshape it from wide to long using   reshape. Allocating 7GB of memory
to Stata leads to 'not enough memory' message even though it is more
than 10 times the dataset. Allocating 12-15GB leads to Stata not
responding in Windows. I do have the latest PC with 64bit Vista and
64bit Stata 10, -compress- does not help either.
Any help is greatly appreciated.   Thanks

Dmitriy Krichevskiy

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