Statalist


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

Re: st: Capturing the directory of a .do file


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Capturing the directory of a .do file
Date   Thu, 6 Sep 2007 11:04:42 -0400

Matthew Clifford <[email protected]>:
Why not just use relative paths, and have folks run the do-file in the
relevant starting directory?  You can see the current directory like
so:

di c(pwd)

Also, you might use / as your dirsep--see -help creturn-:
    c(dirsep) returns a string containing "/".
Note that, for Windows operating systems, a forward slash (/) is
returned rather than a backslash (\). Stata for Windows understands
both, but in programs, using a forward slash is recommended because a
backslash can interfere with Stata's interpretation of macro-expansion
characters.  Do not be concerned if the result of your code is a mix
of backslash and forward-slash characters, such as  \a\b/myfile.dta;
Stata will understand it just as it would understand /a/b/myfile.dta
or  \a\b\myfile.dta.


On 9/6/07, Matthew Clifford <[email protected]> wrote:
> I am trying to find a way to have Stata automatically recognize the path
> from which a .do file is run.
*
*   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