Statalist


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

Re: st: r(files) only with dta files


From   Johannes Geyer <JGeyer@diw.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: r(files) only with dta files
Date   Mon, 8 Sep 2008 09:24:23 +0200

You can use wildcards " * ".

type

help fs

there you find an example:

fs *.dta

Regards,
Johannes

owner-statalist@hsphsun2.harvard.edu schrieb am 08/09/2008 08:45:40:

> Hi,
> 
> I have the following problem, I want to run a loop on all the dta
> files in a directory, I currently have the following code, but am
> having difficulties because I get an error when a do file is included
> in the r(files) macro. Is there anyway I can run this only on .dta
> files? My code is as following...
> 
> log using jfilesearch, replace
> fs
> foreach var in `r(files)' {
> clear
> use `var'
> capture, describe *gdp*
> }
> log close
> 
> Regards,
> Nikhil
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/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/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