Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73368

Looping over dates

$
0
0
Hi everyone!
I've got several dates for which I need several dta. files.

Dates:
01jul2005
28dec2005
26jun2006
23dec2006
21jun2007
18dec2007
15jun2008
12dec2008
10jun2009
07dec2009
05jun2010
02dec2010
31may2011
27nov2011
25may2012
21nov2012
20may2013
16nov2013
15may2014
11nov2014
10may2015
06nov2015

So what I would do is:

use "F:\Stata12\mergi.dta" /*my original file

keep if date == td(1 jul2005)

save "F:\Stata12\mergi1.dta"


use "F:\Stata12\mergi.dta" /*my original file

keep if date == td(28dec2005)

save "F:\Stata12\mergi2.dta"

...

There has to be an easier option by looping over the dates, but I'm not that good in Stata. I use Stata 12.0.
Thanks for your advice!
Richi Rich

Viewing all articles
Browse latest Browse all 73368


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>