SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 33838: Count for certain number of consecutive weekdays

DetailsCodeOutputAboutRate It

The sample data consists of dates, some weekends and some weekdays. The goal is to determine how many days are consecutive, excluding weekends. A Friday and the following Monday are considered consecutive as well as days during the week that are consecutive.

The data is split into two data sets based on weekday versus weekend using the WEEKDAY function. The dates are tested for being consecutive and incrementing the variable COUNT by 1 when that's true. Otherwise, COUNT is reset to 1.




These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.