Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: tempfile & scope


From   "Danielle H. Ferry" <[email protected]>
To   StataList <[email protected]>
Subject   Re: st: tempfile & scope
Date   Thu, 25 Sep 2003 13:49:38 -0400

On 9/25/03 1:20 PM, "Nicholas Winter" <[email protected]> wrote:

> At 05:33 PM 9/25/2003 +0100, you wrote:
>>> This last point seems to be a good one. It's true, I don't
>>> need to define
>>> -tempname- in each loop. I guess I had just put it with
>>> -tempfile- out of
>>> habit. On the other hand, does it really make much
>>> difference? I don't
>>> imagine my computing time is shortened noticeably by
>>> putting it outside the
>>> loop, no?
>> 
>> Nick Winter (!= myself) raised a good point about this.
>> My own posting earlier was mostly fixated on the syntax
>> issue.
>> 
>> It makes a big difference, namely the difference
>> between putting everything in one file and separate
>> results in separate files. Computing time is
>> a side-issue.
>> 
>> With the former, presumably -dsconcat- would be
>> unnecessary.
>> 
>> To add more, we'd need to know more about the real problem.
> 
> 
> Back to Nick Winter (!=Nick Cox; we'll leave aside whether that's > or
> <)... actually, I had only advocated putting the -tempname- outside the
> loop; then you would be opening each (different) file with the same handle.
> 
> To answer Danielle Ferry's question, no, I don't think that would make much
> difference in terms of performance--some tiny bit of extra overhead and
> memory for Stata to create an additional local, but trivial.
> 
> Nick Cox suggests that you could just post everything to one file, rather
> then sending it to two different files then concatenating.  THat seems wise
> to me...
> 
> --Nick W

Okay, I see that it makes sense to post everything to a single file. I was
making things more complicated than necessary. Then I put the -tempname-,
-tempfile-, -postfile-, and -postclose- statements outside the loop. It has
become glaringly obvious that I don't understand the purpose of -tempname-
here. Can someone please explain?

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