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 at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: get the current path


From   Sun Yutao <yutao.sun.statalist@outlook.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: get the current path
Date   Tue, 23 Oct 2012 23:52:46 +0200

Thank you for replying. I'm writing an ado-file and it needs an object (a 
class I wrote), but the thing is the class also can (and will) be used by 
other ado-files (and end-users can use it if they want), so I don¡¯t really 
want to put the class definition and the ado part in one file...

(I purchased "an introduction in stata programming" but it's still on its 
way...so if you know a solution from the book you could also point out for me 
from the book...many thanks!!

Best regards,
Sun Yutao

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu 
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Tuesday, October 23, 2012 11:28 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: get the current path

Strictly, what I mean is that

programs defined by ado-files can call other programs defined by ado-files, 
and so on,

and should point out that how programs are defined is secondary here.
(A program _could_ be defined interactively, although few ever are unless they 
are very short.)

Nick

On Tue, Oct 23, 2012 at 10:22 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> I think the short answer is that
>
> 1. You, the user, can always keep track of what you are using.
>
> 2. It's equally true that what is being executed is not accessible to
> the user as a single path, not least because it need not be one. Given
> that do-files can call other do-files, and so on, and do-files can
> call ado-files, and so on, and ado-files can call ado-files, and so
> on, there can easily be a complicated nested hierarchy. So, the
> current do-file may be uniquely defined if there is just one, but it's
> not a Stata concept given the possibility of a hierarchy.
>
> Any way, what difference would it make?
>
> Nick
>
>
> On Tue, Oct 23, 2012 at 8:55 PM, Sun Yutao
> <yutao.sun.statalist@outlook.com> wrote:
>> Hello everyone,
>>
>> Does anyone know how to get the current path of the file that is
>> being executed? i.e. if c:/foo/bar.do is being executed, then how do
>> I know by some command that it's c:/foo/
>>
>> I don¡¯t need the working dir...

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