Statalist


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

Re: st: clear and clear all


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: clear and clear all
Date   Mon, 03 Aug 2009 12:42:53 -0400


FWIW I've used the following for a few years without problem; this
is part of a script which is called by WinXP to open a datafile
when I double click on it - I always request 50% overhead.

	if (strpos("`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'"
	}

the first condition is because the same script is used to run -do-files.

J

Stas Kolenikov wrote:
So why exactly do you want to -use- a data set, and then -clear- it
away without doing anything to the data?

What might be really cool is to have something along the lines of

use varfile, clear overhead(30) min(10m)

so that behind the curtain Stata would:
1. -clear all-
2. look at the size of varfile on disk
3. -set mem max( (100+overhead)% of the file size, 10m )-
4. -use varfile-

The second step is actually quite complicated. -dir- aka -ls- do not
return anything Stata could understand; the -file- suite in either
Stata or Mata does not have that functionality, either; undocumented
-st_freadsignature()- in Mata cannot really look up the size of the
data file yet as the header it describes has not yet been implemented
for dta files. A working solution is to -describe using varfile- from
which you can figure out the size of the data matrix -r(width)*r(N)-
in bytes. There's still the header of the file with labels, chars and
such that takes some space, too, but the total size of the file is not
returned by -describe-.

On Sun, Aug 2, 2009 at 4:52 AM, Fred Wolfe<[email protected]> wrote:
A minor suggestion for Stata 11.

As Stata 11 requires -clear all- before -set mem-, breaking many older
do files for me, I tried this sequence:

. use varfile,clear all
option all not allowed
r(198);

. use varfile,clear
. clear all
. set mem 1000m

If -clear- is an option to -use-, perhaps Statacorp could also make
-clear all- an option to use.

Fred


--
Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
NDB Office  +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
[email protected]

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




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