Hi Everyone,
Is there a way of retaining tempfiles for longer than the execution of a program? I understand the purpose of a tempfile is to be deleted at the conclusion of a program, but the tempfile generation is happening as part of a sub-routine and isn't a part of the main do file. I tried using an include command but it didn't work as I had hoped.
My include.do file is:
And when I want to execute it it would be:
Functionally, I want to be able to define a tempfile in one program and read it in another. Is there a way of doing this?
Cheers,
David.
Is there a way of retaining tempfiles for longer than the execution of a program? I understand the purpose of a tempfile is to be deleted at the conclusion of a program, but the tempfile generation is happening as part of a sub-routine and isn't a part of the main do file. I tried using an include command but it didn't work as I had hoped.
My include.do file is:
Code:
local hi "this worked" tempfile test1
Code:
. program drop _all . program stitch 1. tempfile test1 2. clear 3. set obs 1 4. gen strL general = "Kenobi" 5. save `test1', replace 6. clear 7. end . program me 1. include "C:\Users\dspeed\OneDrive - University of New Brunswick\Desktop\testdoh.do" 2. dis "`hi'" 3. use `test1', clear 4. end . end of do-file . stitch number of observations (_N) was 0, now 1 (note: file C:\Users\dspeed\AppData\Local\Temp\ST_5c_000001.tmp not found) file C:\Users\dspeed\AppData\Local\Temp\ST_5c_000001.tmp saved . me . local hi "this worked" . this worked invalid file specification r(198); .
Cheers,
David.
Comment