I intend to use the `temp' file in multiple DO files, however, the file vanishes as the first do file concludes.

I tried the following commands and variation of it, but all in vain.

tempfile main
save `main',emptyok
global main `main'

use $main
Do1.do
clear

use $mian
Do2.do
clear

Can someone help me out on how to save the temporary file in a global macro rather than a local.
Thanks