Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Identifying the do-file source code of tables and graphs


From   Steven Samuels <sjhsamuels@earthlink.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Identifying the do-file source code of tables and graphs
Date   Tue, 2 Sep 2008 23:40:07 -0400

My method for self-documentation:

1. Break up analyses into a series of do files.
2. In each, set a local macro with the program file name: e.g. local pname "p03_an.do"
(In a NetCourse, Bill Gould suggested that different programs create (e.g. name p02_cr) and analyze (e.g. p03_an.do)
3. Set a local macro with the name of the data set(s) analyzed: local dfiles "d03.dta"
4. Create a local macro docit with text "Program: `pname'. Data: `dfiles'."
5. Display `docit' periodically.
6. Add `docit' as text to graph notes.
7. Add the graph number (eg. g03_01 (program p03, graph 1) to graph notes

I always add the program and data set names to rtf tables, and remove them only in the submitted versions.

-Steve

On Sep 2, 2008, at 6:22 PM, Sergiy Radyakin wrote:


Hello Michael,

Look for an older thread "Does a do file know it's name?", e.g. here:
http://www.stata.com/statalist/archive/2007-08/msg00584.html

As far as I know - you have to define the filename either in that file
(e.g. as a local) or in the calling program, which probably calls each
of your individual do files (e.g. as a global).

If you use xml_tab for output, it is convenient to have sheets named
as do-files, and you then have a single Excel file with all your
tables. You can append tables from multiple .do files to a single
output file, so you can form your report step-by-step.

Hope this helps,
   Sergiy Radyakin

On 8/31/08, Michael McCulloch <mm@pinest.org> wrote:
Hello,
I'm preparing a long paper which includes tables and graphs generated by
code from an (also very long) do-file. Is there a simple way to append to
those tables and graphs the originating do-file's file name and the file
number where that code would be found?

--

Best wishes,
Michael McCulloch



Pine Street Foundation
124 Pine St., San Anselmo, CA 94960-2674
Tel: (415) 407-1357
Fax: (415) 485-1065
mcculloch@pinestreetfoundation.org
www.pinestreetfoundation.org
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index