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

st: I can't get fs to work from inside a do file

From   Gabi Huiber <>
Subject   st: I can't get fs to work from inside a do file
Date   Fri, 15 Feb 2008 21:24:00 -0500

Hello all,

Nick Cox has this little command called fs, which reads the files in a
certain folder and remembers them in r(files). I tried to use it to
run a bunch of do-files from inside a root do-file, because the name
and number of these subsequent do-files can vary between the
sub-folders of interest. So here's what I did:

. ***************** CALL DO-FILES SPECIFIC TO EACH ${paper} HERE
. fs prototype/${paper}/*.do
> local dofiles=r(files)
> foreach k of local dofiles {
> do "prototype/${paper}/`k'"
> }
> clear
> di "goodbye"

As you can see, Stata breezes right through the lines after fs. It
also does not interpret fs: display r(files) shows nothing. However, I
can copy the fs line from the results window and paste it in the
command window, and it will execute just fine. Ditto for all the lines
below it.

Any ideas?

Thank you,

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index