Having a long .do file with many graphs and tables being exported, I face the problem that when changing some settings, I need to work manually through the whole .do-file to change the settings of every graph by hand. At best, I can use the "replace" function (not in Stata as far as I know, but when opening the file in notepad). I am looking for a way to work more efficiently here.
specifically, an often repeated chunk of code in my work is:
This is repeated multiple times with different variables than mpg.
Now, one option for me would be to define the graph settings centrally for all histograms and other graphs. But this would make me unflexible if I need a few graphs with different settings, e.g. different colorstyle.
What I am looking for is a rather crude way of defining a placeholder such as "mysettings" in the beginning of the .do-file, such as:
then using only
Similarly, my esttab command requires quite heavy modification before I output it into latex, for which I use addnotes as follows:
After having figured this out, replacing it in my dozens of tables was a pain, which would have been relieved by
and then
Ideally, I am not looking for centralized options, but just placeholders that I can define at one place and that do not interfere at all with the actual table creation, but only with my comfort in handling the document.
specifically, an often repeated chunk of code in my work is:
Code:
sysuse auto.dta histogram mpg, start(0) frequency color(gs12) graphregion(color(white)) /// graph export mpg.png, replace
Now, one option for me would be to define the graph settings centrally for all histograms and other graphs. But this would make me unflexible if I need a few graphs with different settings, e.g. different colorstyle.
What I am looking for is a rather crude way of defining a placeholder such as "mysettings" in the beginning of the .do-file, such as:
Code:
mysettings = "frequency color(gs12) graphregion(color(white))",
Code:
histogram mpg, mysettings /// graph export mpg.png, replace
Code:
esttab est1 est2 /// using regcompare1.tex, mtitles /// p r2 replace noconstant /// nonotes addnotes("\textit\(p\)-values in parentheses" /// "\makebox[\widthof{\sym{***}}][r]{\sym{*}} \(p<\) 0.05" /// "\makebox[\widthof{\sym{***}}][r]{\sym{**}} \(p<\) 0.01" /// "\makebox[\widthof{\sym{***}}][r]{\sym{***}} \(p<\) 0.001")
Code:
"mytabsettings" = "p r2 replace noconstant /// nonotes addnotes("\textit\(p\)-values in parentheses" /// "\makebox[\widthof{\sym{***}}][r]{\sym{*}} \(p<\) 0.05" /// "\makebox[\widthof{\sym{***}}][r]{\sym{**}} \(p<\) 0.01" /// "\makebox[\widthof{\sym{***}}][r]{\sym{***}} \(p<\) 0.001")"
Code:
esttab est1 est2 /// using regcompare1.tex, mtitles /// mytabsettings
Comment