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

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

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

Matthew Clifford <>:
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

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 <> 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:

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