Hi,
The title makes this question seem, poor, but highlights what I am trying to do.
I have a large do-file, which calls other do-files. In those other do files, I would like to create temporary files to be used in the larger do-file. tempfile, is cleared at the conclusion of the sub do-files. Below is a brief example
do file 1
-------------------------
use "somefile.dta"
tempfile trial
save "`trial'"
global Trial `trial'
clear
----------------------------
do file 2
do (do file 1)
use "someotherfile.dta"
merge m:1 unique_id using $Trial
I thought the global would be a work around for this, but it seems all the global does is call up the local macro, which after the conclusion of "do file 1" is cleared. Is there a way to use a global to store a file in, and perform actions like this.
As a temporary solution, I can save the file and manually delete it afterwords. But this seems clunky, and I think there must be a way to call a temporary file across do-files.
Thanks for the help.
-Greg
The title makes this question seem, poor, but highlights what I am trying to do.
I have a large do-file, which calls other do-files. In those other do files, I would like to create temporary files to be used in the larger do-file. tempfile, is cleared at the conclusion of the sub do-files. Below is a brief example
do file 1
-------------------------
use "somefile.dta"
tempfile trial
save "`trial'"
global Trial `trial'
clear
----------------------------
do file 2
do (do file 1)
use "someotherfile.dta"
merge m:1 unique_id using $Trial
I thought the global would be a work around for this, but it seems all the global does is call up the local macro, which after the conclusion of "do file 1" is cleared. Is there a way to use a global to store a file in, and perform actions like this.
As a temporary solution, I can save the file and manually delete it afterwords. But this seems clunky, and I think there must be a way to call a temporary file across do-files.
Thanks for the help.
-Greg
Comment