Statalist The Stata Listserver


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

st: using pwd in an if statement


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: using pwd in an if statement
Date   Tue, 16 May 2006 19:43:54 -0400

No need:

If I am in a directory, say C:data\scholar\Hannah, and I type

-cd Hannah-

I get an error message, as one might expect.

I am just learning to use .do files for the bulk of my analyses and data
manipulations, a la Svend Juul's great book.  I usually try to -cd- to
the relevant project directory somewhere near the begining of a .do
file, then open the data file.

But if I am *already in* that directory when I run the .do file, Stata
gives the same sort of error:

cd Hannah
unable to change to Hannah
r(170);
end of do-file


Just do

capture cd Hannah




Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


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