1) From within a do-file, is there some way to determine the filename of the do-file? I often want to have a do-file open a log file of the same name, without having to hardcode the name into the do-file, so that when I clone the do-file I don't have to remember to edit the logfile name.
2) From within a do-file, is it possible to programmatically set the width of the results window, which determines the line length of a text log file, so that I can print the text log file without truncation caused by a results window wider than my printer line length?
For (1), the altnernative for me is to write a general-purpose dofile (or for convenience an ado-file I think) that takes as its argument the do-file name, opens a log with that name, runs the do-file, and closes the log afterwards. If I did that, I guess I could have the general-purpose do-file capture noisily to run the called do-file, which would let the outermost do file close the log even if the innermost one failed. Maybe that's the way to go.
For (2), I seem to have to fiddle with the window each time I run Stata [Stata/SE 13.1 for Mac (64-bit Intel) Revision 19 Dec 2014], perhaps because once Stata is launched, I immediately put it into the Mac full-screen mode. The description of set linesize found in help log is almost amusing in its documentation of its lack of general usefulness, perhaps to discourage former SAS users familiar with the linesize option in SAS. I am aware of creating SMCL logs and using translate, but I want text logs that I can read and print in a text editor outside of Stata. I don't place much value on the Stata formatting in SMCL. Perhaps I should?
I'd appreciate hearing the voice of experience on this, over and above the answers to my specific questions. Am I trying too hard to match a non-Stata (i.e., SAS) work environment I have been productive in? Thanks in advance to anyone who can advise me on this.
2) From within a do-file, is it possible to programmatically set the width of the results window, which determines the line length of a text log file, so that I can print the text log file without truncation caused by a results window wider than my printer line length?
For (1), the altnernative for me is to write a general-purpose dofile (or for convenience an ado-file I think) that takes as its argument the do-file name, opens a log with that name, runs the do-file, and closes the log afterwards. If I did that, I guess I could have the general-purpose do-file capture noisily to run the called do-file, which would let the outermost do file close the log even if the innermost one failed. Maybe that's the way to go.
For (2), I seem to have to fiddle with the window each time I run Stata [Stata/SE 13.1 for Mac (64-bit Intel) Revision 19 Dec 2014], perhaps because once Stata is launched, I immediately put it into the Mac full-screen mode. The description of set linesize found in help log is almost amusing in its documentation of its lack of general usefulness, perhaps to discourage former SAS users familiar with the linesize option in SAS. I am aware of creating SMCL logs and using translate, but I want text logs that I can read and print in a text editor outside of Stata. I don't place much value on the Stata formatting in SMCL. Perhaps I should?
I'd appreciate hearing the voice of experience on this, over and above the answers to my specific questions. Am I trying too hard to match a non-Stata (i.e., SAS) work environment I have been productive in? Thanks in advance to anyone who can advise me on this.
Comment