Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Do Files and Arguments


From   Erika Kociolek <ekociole@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Do Files and Arguments
Date   Mon, 8 Apr 2013 06:29:43 -0700

Thank you for pointing me to some helpful resources!

Erika

On Sun, Apr 7, 2013 at 5:26 PM, Phil Clayton
<philclayton@internode.on.net> wrote:
> Alternatively you could pass the quarter as a argument to the do-files. See "[U] 16.4 Programming with do-files" for details.
>
> Phil
>
> On 08/04/2013, at 10:20 AM, Nick Cox <njcoxstata@gmail.com> wrote:
>
>> You could use a global.
>>
>> Nick
>> njcoxstata@gmail.com
>>
>>
>> On 8 April 2013 01:14, Erika Kociolek <ekociole@gmail.com> wrote:
>>> Hi all,
>>>
>>> My question is related to .do files and passing arguments to them.
>>> Let's say that I have a file called master.do, and the .do file I want
>>> to run from master.do is called routine1.do.
>>>
>>> Here's the syntax in the file master.do:
>>>
>>> local quarter 2
>>> cd C:/Directory/MyDirectory/Q`quarter'_2012/
>>>
>>> do routine1
>>>
>>>
>>> Here is the syntax in the file routine1.do :
>>>
>>> use ../Q`quarter'_2012/mystatafile.dta, clear
>>>
>>>
>>> I don't want to have to define the local "quarter" in all of the .do
>>> files that I want to call and run in master.do. Is there any way to
>>> pass along the quarter argument to files called in the master.do file?
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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