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: Reading multiple .csvs from a folder


From   Matthew White <mwhite@poverty-action.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Reading multiple .csvs from a folder
Date   Wed, 16 Nov 2011 15:12:33 -0500

Let's say the directory that contains the .csv files is stored in the
local `directory'. This will store all .csv files in `directory' in
the local `csvs':

local csvs : dir "`directory'" files "*.csv"

See -help extended_fcn- for more details. If you want to apply a regex
filter, I think you'll have to loop through the files in `csvs'
individually.

Best,
Matt

On Wed, Nov 16, 2011 at 3:03 PM, Vianney <vbrandicourt@gmail.com> wrote:
> Hello collective wisdom,
>
> I was wondering if STATA has a means of reading all .csvs (or similar
> formats) from within a designated folder.
>
> Namely, instead of having to designate specific .csv *filenames*, I'd
> like to be able to designate a *folder* (and potentially apply a regex
> or regex-like filter for choosing specific .csvs from within said
> folder).
>
> I am essentially looking for the STATA equivalent of Python's GLOB [
> http://docs.python.org/library/glob.html ;]
>
> Many thanks for your insights!
>
> Best regards,
> Vianney
>
> *
> *   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/
>



-- 
Matthew White
Data Coordinator
Innovations for Poverty Action
101 Whitney Avenue, New Haven, CT 06510 USA
+1 434-305-9861
www.poverty-action.org

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