Dear All,
I am looking for a way to make use of temporary files with the putpdf image command. Unfortunately, I find no way to make them understand each other. If the image is saved to a tempfile, the putpdf image command aborts with an error that the file type is not recognized (apparently it naively looks by the extension, and not by the actual contents, so fails on *.tmp files).
Saving the file as "`tmp'.png" is subject to two problems:
1. files are no longer temporary - they will not be deleted by Stata's tempfile tracker after the end of the code scope.
2. collisions are possible (and as a matter of fact likely) with files generated in previous runs, or in other sessions.
If in doubt, refer to the manual: "tempfile assigns names to the specified local macro names that may be used as names for temporary files. When the program or do-file concludes, any datasets created with these assigned names are erased."
Here "with these" means "exactly with these", not "derived from these".
Clearly adding the replace option is not a solution, as it hides the problem out of view, but doesn't solve it, and potentially can lead to incorrect reporting.
I see the following four ways of solving:
1. convince Stata to generate a temporary filename with a particular extension, in which case that could have been an option of the tempfile command, but there is none.
2. request Stata to create a temporary folder (not file, but folder) name, in which case I can be confident that my code owns the folder and can use fixed names (this would also be useful for my another project as well).
3. teach the putpdf to be more sophisticated and look into the contents of the file to determine it's type, or allow the user to specify it directly as an option, putpdf image ....., as(png).
4. teach graph save to save directly to the pdf document (do not confuse with saving as a pdf file, that's different).
All of these require intervention of the developers. Any advice from the fellow coders is much appreciated.
Best, Sergiy Radyakin
Related Posts with 🗎 Temporary file with -tempfile-
How to make this type of graph?Hello guys, Do you have any idea how to make the chart below? It is a histogram of frequencies of …
categorizing continuous dataHello, I would be super grateful for some help with the following scenario Maternal obesity is cons…
profileplotHi, I'm using Stata version 11, and despite repeated attempts, unable to download the profileplot pr…
Generating a new variable that is the sum of each value of a different variableHello. This seems like it would be straightforward but as an advanced beginner I am having a hard ti…
How to create and define 30 minutes interval data in Stata?Dear user, My data is 30 minutes interval. I want to declare as time series. For daily time series d…
Subscribe to:
Post Comments (Atom)
0 Response to 🗎 Temporary file with -tempfile-
Post a Comment