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

From |
"Mingfeng Lin" <mingfeng.lin@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: combining many data files |

Date |
Wed, 19 Nov 2008 22:04:58 -0500 |

Thank you Kyle! I never used extended functions before - this is very neat. You left out "files" on the first line, but after I add that in, it works great! The first line should be local x : dir "C:\mydir" files "*.dta" Thanks again! Mingfeng On Wed, Nov 19, 2008 at 9:46 PM, Kyle Hood <kyle.hood@yale.edu> wrote: > of course, I left out a critical command: > > local x : dir "c:\mydir" "*.dta" > cd c:\mydir > > foreach d of local x { > use `d', clear > cap append using appendfilename > save appendfilename, replace > } > > Kyle Hood wrote: >> >> there is no way to get append to recognize a wild card. However, you can >> use the "dir" extended function. Type >> >> help extended_fcn >> >> example: >> >> >> Mingfeng Lin wrote: >>> >>> Greetings! >>> >>> I am wondering if there's a straightforward way to append a large >>> number of .dta files into one file using Stata? The -append- command >>> seems to disallow wildcards in the file names. I do find one method >>> from UCLA's ATS website, >>> >>> http://www.ats.ucla.edu/stat/stata/faq/append_many_files.htm >>> >>> but I'm still hoping there's an easier way, or somehow getting the >>> -append- command to recognize the wildcards - so that I could just >>> simply type >>> >>> append using *.dta >>> >>> Thanks :) >>> >>> Mingfeng >>> * >>> * 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/ >>> >> >> > > > -- > Kyle Hood > Department of Economics > Yale University > New Haven, CT > website: http://www.econ.yale.edu/~kkh25 > > * > * 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/

**References**:**st: combining many data files***From:*"Mingfeng Lin" <mingfeng.lin@gmail.com>

**Re: st: combining many data files***From:*Kyle Hood <kyle.hood@yale.edu>

**Re: st: combining many data files***From:*Kyle Hood <kyle.hood@yale.edu>

- Prev by Date:
**Re: st: RE: combining many data files** - Next by Date:
**Re: st: RE: combining many data files** - Previous by thread:
**Re: st: combining many data files** - Next by thread:
**st: RE: combining many data files** - Index(es):

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