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 on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Counting Number of Week-Days


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Counting Number of Week-Days
Date   Tue, 7 Sep 2010 17:20:29 +0100

I'm guessing that "weekdays" means for you Monday-Friday. Given daily dates, say in a variable -date-, -dow(date)- is 0 ... 6 on Sunday ... Saturday. 

Thus the examples 

. count if !inlist(dow(date), 0, 6) 

. count if inrange(dow(date), 1, 5) 

. egen whatever = total(inrange(dow(date)), by(somethingelse) 

show various techniques that may be useful. If this doesn't help, you may need to be more precise about your set-up. 

Nick 
n.j.cox@durham.ac.uk 

Simone Peart Boyce

I'm trying to determine the number of week-days between two dates.  Is there an 
easy way to do this in 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index