Computing elapsed workdays --------------------------
^workdays^ startvar endvar [^if^ exp] [^in^ range] [^using^ filename]^,^ ^gen(^diffvar^)^ [^holiday(^holidayvar^)^ ^lazy^]
Description -----------
^workdays^ is used to compute the number of workdays between two variables containing dates. It can use an optional file to include holidays as well. Right now, there is no flexibility for the definition of a "workday", since both Saturday and Sunday are considered the weekend.
Options ------- ^gen^ gives the name of a new variable to generate. It is not optional!
^holiday^ can be used only when ^using^ a holiday file. It gives the name of the holiday date variable in the holiday file, which must be a Stata date variable. The holidays are read from this file and stored in the global macro ^S_HOLI^.
^lazy^ tells workday to use the global macro ^S_HOLI^ (if it exists), rather than recreating it from the holiday file. This will save time when the holidays have not been updated, and there are large amounts of data already in use.
Examples ----------
^workdays start end, gen(diff)^ ^workdays start end using "US Holidays", holiday(daysoff) gen(workwork)^ ^workdays start end using "US Holidays", holiday(daysoff) gen(morework) laz > y^
Notes -----
The S_HOLI global macro is defined, and then overwritten by this command (unless the lazy option is specified). In this way, once the command has been run once, there is no need to go get the holiday definitions a second time. If you want to get rid of the global macro for some reason, type global S_HOLI at the Stata prompt.
References ----------
see also @functions@ for the ^dow()^ function
Author ------
Bill Rising (brising@@stata.com)