Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Query dataset size


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: Query dataset size
Date   Tue, 05 Dec 2006 12:20:09 -0500

Sorry, directed this to Austin, who already posted this
solution (more or less) when in fact Julian raised the
question.



Jeph Herrin wrote:
Austin,

My -profile.ado- file uses the following routine when I open
a dataset by double-clicking in XP (so if the argument is a .dta
file):

if "`1'"~="" {
    if (index("`1'",".dta")>0) {
        d using "`1'", short
        local size = int(r(width)*r(N)*1.5/(2^20))
        local size = max(10,`size')
        set mem `size'm
        use "`1'"
    }
}

So -describe- returns the width & obs and I figured by trial
and error that in memory a dataset needs r(width)*r(N)*1.5/(2^20)
MB.

hth,
Jeph


Austin Nichols wrote:
Julian & Bill--
As nice as the -memory- command is, it has the downside of requiring
you to load the data in memory before issuing the command, whereas the
-describe- command has the handy using option.  If you are deciding
how much memory to allocate with -set mem Xm- for example, it's
helpful to not have to load the data first.
--Austin

On 12/5/06, William Gould, Stata <[email protected]> wrote:
Julian Reif <[email protected]> asked,

> Is there a Stata command available that returns the size of the dataset in
> memory? I am running a series of very long scripts at the same time on a
> server and am performing an analysis to determine what the optimal memory
> allocation should be for each series of scripts. I know that the -describe-
> command will tell you the size, but it does not return the value in a local
> and I'd rather not go hunting through log files if possible.

I suggest Julian try the -memory- command, which presents a report and leaves
results behind in r(). The results are different that those reported by
-describe- but they may be more in line with what Julian wants, as these
numbers are more system related and include overhead.

-- Bill
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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