Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Relative Paths in Stata 12


From   Robert Picard <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Relative Paths in Stata 12
Date   Thu, 5 Sep 2013 14:36:17 -0400

Relative paths are and have always been relative to the current
directory. One difference with Stata 12 is that on open, it restores
the current directory to what it was when the application quit. Before
that, Stata (Mac) opened with the user's home directory (~/documents/)
or the Stata application directory for version 9.

Currently, there is no way to request from Stata the path to the
currently running do-file. In part, this is because the concept is
ambiguous as there can be more than one do-file running when do-files
are nested. You may want to take a look at -project-, recently added
to SSC. With -project-, the current directory is always aligned with
the currently running do-file so you can use relative paths as you
described.


On Thu, Sep 5, 2013 at 12:21 PM, Conor Hughes <[email protected]> wrote:
> Hello All,
> Recently I've been trying to  work on a project I originally began in
> Stata 10 on Mac OS. I'm now running Stata 12 (also on Mac), and
> finding that my relative paths aren't working as they were previously.
> For example, running a do file containing:
>
> clear all
> cap log close
> log using "./example.log", replace
>
> Previously, the "./" was evaluated as the directory of the do file
> that was running. Now when I try to run it, it just goes to the
> current working directory. The same happens when using "../", for
> example -insheet using "../import/raw.txt", clear-. Has anyone run
> into issues like this before? There will eventually be a number of
> people working on this out of a shared folder, so it would be
> preferable not to have to edit the working directory manually every
> time a new user goes to run something.
>
> Thanks, and have a great day,
> Conor
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index