Keith,
it is a brilliant idea - it never occurred to me to use a loop cycle to
shuffle through the days one by one! thank you!
Olex
> Maybe like this?
>
> cap prog drop datecount
> prog datecount
> args month day start end
> loc month=upper(substr("`month'",1,3))
> scalar datecount=0
> forval d=`=d(`start')'/`=d(`end')' {
> loc thismonth=upper(ltrim("`:di %dm `d''"))
> if "`month'"=="`thismonth'" & `day'==day(`d') scalar
> datecount=datecount+1
> }
> di as result datecount
> end
>
>
> datecount sept 15 28jan1997 17sep2002
> 6
> datecount Feb 2 28jan1997 17sep2002
> 6
> datecount february 29 28jan1997 17sep2002
> 1
>
>
> Regards,
> kd
>
>
>
> Olexandr O. Vasetsky wrote:
>> Hi guys,
>>
>> I am trying to calculate the number of certain day and month
>> occurrences
>> between the two dates: e.g. calculating the number of September 15th's
>> and
>> February 2nd's from 28-Jan-1997 to 17-Sept-2002.
>>
>> any ideas will be appreciated
>>
>>
>
> --
> Dr Keith Dear
> Senior Fellow
> National Centre for Epidemiology and Population Health
> ANU College of Medicine, Biology and Environment
> Building 62, cnr Mills and Eggleston Roads
> Australian National University
> Canberra ACT 0200 Australia
>
> T: 02 6125 4865
> F: 02 6125 0740
> M: 0424 450 396
> W: nceph.anu.edu.au/Staff_Students/staff_pages/dear.php
>
> CRICOS provider #00120C
> http://canberragliding.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/
>
>
>
--
Sincerely,
Olexandr Vasetsky
Graduate student
Department of Economics
University of Calgary
*
* 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/