Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: confirm
From
Dimitri Szerman <[email protected]>
To
statalist <[email protected]>
Subject
st: confirm
Date
Wed, 18 Aug 2010 11:24:52 +0100
Hello,
Here's what I'm trying to do. I have a directory with many files, one for
each weekday of the year. Some files are missing, and I want to find out
which files are missing. The filenames make it easier to use a loop and
confirm, and I came up with this:
local YEAR 2006
local MONTH 01 02 03 04 05 06 07 08 09 10 11 12
local DAY 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30 31
foreach Y of local YEAR {
foreach M of local MONTH {
foreach D of local DAY {
scalar day = mdy(`M',`D',`Y')
scalar satsun = dow(day)
if satsun!=0 & satsun!=6 & satsun!=. {
confirm file "`Y'`M'`D'.csv"
}
}
}
}
Now, my problem is, this code will stop on the first missing file. What I'd
like is to have is Stata printing a list of missing files. Any ideas would
be much appreciated.
Many thanks,
Dimitri
*
* 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/