Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Global Macro?


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: Global Macro?
Date   Fri, 28 Oct 2005 13:24:56 -0400

I usually approach this problem by using relative referencing for file paths in my do files. For example, you could have lines like:

log using logs/thislog
use data/myfile
...
save results/myresults

Then you do files will run just fine regardless of where the main directory is located, as long as the subdirectory structure is the same.

Michael Blasnik
[email protected]

---------------------------
<[email protected]> asked:
Subject: st: Global Macro?



Hi I have a question:

I have a number of subroutines that I want to be able to run from a master file
and also send to someone else who has a different file structure than myself.
What I tried to do was this:

*************************
global do_dir "C:\Project\Do Files"
global data_dir "C:\Project\Data"
global log_dir "C:\Project\Log Files"
global output_dir "C:\Project\Output"

do Subroutine1
do Subroutine2
do Subroutine3

macro drop do_dir
macro drop data_dir
macro drop output_dir
************************

There are parts of each subroutine that refer to each directory and I just want
to reference them in this file, so the person that I'm working with just has to
cut and paste once for each directory when I send it to them.

Is there a better way to do this??

Thanks for any help in advance!

Ben
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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