Statalist The Stata Listserver


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

Re: st: Master do file- error


From   "Neil Shephard" <[email protected]>
To   [email protected]
Subject   Re: st: Master do file- error
Date   Thu, 14 Jun 2007 09:29:17 +0100

On 6/14/07, Carola Weiss <[email protected]> wrote:
Hi everybody,

I would like to create a master do file. But my problem ist that if I type all my do files I get the error message "file not found". I don�t know what�s wrong. Is it possible that my do files aren�t allowed to refer to another do file? e.g:: do file 2 refers to do file 1?

Without seeing your directory structure and what you've typed its
impossible to diagnose, but a good guess would be that your do-files
are in a different directory from the one that Stata is in when you
try to call them from your master-do file.

An example of the directory structure (and some of the do-files) of
one of my work folders is given below....

.
|-- data
|   |-- clean
|   |-- ped
|   |-- raw
|   |   |-- bcap
|   |   |-- bid
|   |   |   `-- pedgenie
|   |   |-- hapmap
|   |   |-- snphap
|   |   `-- unphased
|   |-- stata
|   |   `-- res
|   `-- txt
|-- log
|   `-- qc
|-- res
|-- scripts
|   |-- bid_analysis.do
|   |-- bid_master.do
|   |-- bid_prep.do
|
`-- tmp

As you can see I have three do-files that reside in the sub-directory
scripts.  I will start Stata and -cd- to the directory the highest
level of this directory (in this instance all of the above are
contained in a folder caller 'prostate').

I can then call the 'bid_master.do' file by typing -do
scripts/bid_master.do'.  This simply calls the other two do-files, but
refers to them as being in the directory scripts/ ....

$ more scripts/bid_master.do
 do scripts/bid_prep
 do scripts/bid_analysis

If Stata is saying 'file not found' then it means exactly that, you
are "asking" Stata to do something with a file that does not exist in
the location you have typed.  Check these, and be wary of any -cd-
commands in your scripts as Stata will then be in a different
directory and the relative paths will not exist.

An alternative is to always use absolute paths.  A caveat to this is
that if your path contains spaces then you should enclose it in
double-quotes.

Neil
--
"In mathematics you don't understand things. You just get used to
them."  - Johann von Neumann

Email - [email protected] / [email protected]
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/

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