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

Re: st: sysdir set for do-files or datasets ?


From   Ulrich Kohler <kohler@wz-berlin.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: sysdir set for do-files or datasets ?
Date   Thu, 18 Dec 2003 10:19:07 +0100

Misha Bonch-O wrote:
> With sysdir set, we can specify a personal  directory for ado-files,
> where Stata will look them up first.
> Is it possible to do the same for do-files ?  Or for the datasets ?
> I prefer to keep my datasets and do-files that I run in the different
> directories.
> Therefore, if my current working directory is the one with the datasets,
> I always have to write a very long path to: do "longpath"a.do
>
> Other way, of course, is to set current directory with do-files, but I
> will have to  write long path names when I use or save datasets.
> Is there way to set up a default directory, where Stata starts looking
> for do-files or datasets ?
> Thank you, for attention.
> Misha Bonch-Osmolovski.
> UNC-Chapel Hill.

One way is to define global macros in your "profile.do". If you have commands 
like  

----------------------------------------------profile.do
global em "M:/group/mygroup/myunit/ourdata/mydata/em"
global projdo "M:/group/mygroup/myunit/ourproject/mydofiles/"
--------------------------------------------------------

in "profile.do" you can use commands like

. dir $em/*.dta
. describe using $em/mydata
. do $projdo/an1.do

in your do files and interactively. 

See -help profile- for a describtion of profile.do.

Another way is the package -fastcd- by Nick Winter, which can be installed 
with 

. ssc install fastcd

from the Boston-Archive.

Many regards
uli

-- 
kohler@wz-berlin.de
+49 (030) 25491-361


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index