Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Need help with working with multiple files


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Need help with working with multiple files
Date   Mon, 27 May 2013 20:27:05 +0100

Sure. You can loop over filenames. See -fs- from SSC for one
convenience command.

Nick
njcoxstata@gmail.com


On 27 May 2013 20:19, Michael Stewart <michaelstewartresearch@gmail.com> wrote:
> Hi
> I am trying to find a way to work multiple files successively.
> I have multiple large files(really large) placed in different directories
> I am trying to find a way to load each file into stata, complete bunch
> of same datamagement tasks,create  a new file from it and places them
> in a common folder
>
> I could use a dofile and do something like
>
> clear
> use c\data\dataset-1
> datamagement tasks
> datamagement tasks
> datamagement tasks
> save c\data\dataset-1_new
> clear
> use c\data\newdata\dataset-2
> datamagement tasks
> datamagement tasks
> datamagement tasks
> save c\data\newdata\dataset-2_new
> clear
>
> But is there an elegant and simpler way to do it given that I have
> nearly 15 files to do data management tasks.
>
> Can we use foreach loop / forvalues loop or anything like that .Please suggest
>
>
>
>
> --
> Thank you ,
> Yours Sincerely,
> Mike.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index