CREATE_WEEKENDS Procedure
Standard Library procedure that creates the system variable !Weekend_List, which is used in calculating Date/Time compression.
Usage
CREATE_WEEKENDS, day_names
Input Parameters
day_names—A string or string array containing the weekend names.
Keywords
None.
Discussion
The result is stored in the system variable !Weekend_List, a seven-element integer array. The values in !Weekend_List are either ones or zeros, where 1 represents a weekend and 0 represents a weekday. The first element of !Weekend_List represents Sunday, and the last represents Saturday. !Weekend_List is used in calculating Date/Time compressions for functions that take the Compress keyword.
For instance, the routines DT_SUBTRACT, DT_ADD and DT_DURATION, can use the Compress keyword which, if set, excludes weekends from their results. In addition, the PLOT procedure uses the Compress keyword to remove weekends from a plot.
The values in the input string day_names must match or be a substring of strings in the !Day_Names system variable. By default, !Day_Names contains:
PRINT, !Day_Names
; PV-WAVE prints the following:
; Sunday Monday Tuesday Wednesday Thursday
; Friday Saturday
Thus, day_names = ['Sat', 'Sun'] is a valid assignment. If all days of the week are set to weekends, an error results.
Example
; Defines Saturday as a weekend.
CREATE_WEEKENDS, 'Sat'
PRINT, !Weekend_List
; PV-WAVE prints: 0 0 0 0 0 0 1
The first element in the array !Weekend_List represents Sunday. The last represents Saturday. Weekend days have a value of 1.
See Also
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.