CALENDAR Procedure

Example 5: Schedule Calendar, Blank or with Holidays

Features:
PROC CALENDAR statement options:
FILL
HOLIDATA=
INTERVAL=WORKDAY
Other statements:
DUR statement
HOLIDUR statement
HOLISTART statement
HOLIVAR statement

Details

This example produces a schedule calendar that displays only holidays. You can use this same code to produce a set of blank calendars by removing the HOLIDATA= option and the HOLISTART, HOLIVAR, and HOLIDUR statements from the PROC CALENDAR step.

Program

data acts;
   input sta : date7. act $ 11-30 dur;
   datalines;
01JAN03   Start                 0
31DEC03   Finish                0
;
data holidays;
   input sta : date7. act $ 11-30 dur;
   datalines;
01JAN03   New Year's            1
30MAR03   Good Friday           1
28MAY03   Memorial Day          1
04JUL03   Independence Day      1
03SEP03   Labor Day             1
22NOV03   Thanksgiving          2
25DEC03   Christmas Break       5
;
options formchar="|----|+|---+=|-/\<>*";
proc calendar data=acts holidata=holidays fill interval=workday;
   start sta;
   dur dur;
   holistart sta;
   holivar act;
   holidur dur;
   title1 'Calendar of Holidays Only';
run;

Program Description

Create the activities data set. Specify one activity in the first month and one in the last, each with a duration of 0. PROC CALENDAR does not print activities with zero durations in the output.
data acts;
   input sta : date7. act $ 11-30 dur;
   datalines;
01JAN03   Start                 0
31DEC03   Finish                0
;
Create the holidays data set.
data holidays;
   input sta : date7. act $ 11-30 dur;
   datalines;
01JAN03   New Year's            1
30MAR03   Good Friday           1
28MAY03   Memorial Day          1
04JUL03   Independence Day      1
03SEP03   Labor Day             1
22NOV03   Thanksgiving          2
25DEC03   Christmas Break       5
;
Set the FORMCHAR option.Setting FORMCHAR to this exact string renders better HTML output when it is viewed outside of the SAS environment where SAS Monospace fonts are not available.
options formchar="|----|+|---+=|-/\<>*";
Create the calendar. DATA= identifies the activities data set; HOLIDATA= identifies the holidays data set. FILL displays all months, even those with no activities. By default, only months with activities appear in the report. INTERVAL=WORKDAY specifies that activities and holidays are measured in 8-hour days and that PROC CALENDAR schedules activities only Monday through Friday.
proc calendar data=acts holidata=holidays fill interval=workday;
Specify an activity start date variable and an activity duration variable. The START statement specifies the variable in the activities data set that contains the starting date of the activities; DUR specifies the variable that contains the duration of each activity. Creating a schedule calendar requires START and DUR.
   start sta;
   dur dur;
Retrieve holiday information. The HOLISTART, HOLIVAR, and HOLIDUR statements specify the variables in the holidays data set that contain the start date, name, and duration of each holiday, respectively. When you use a holidays data set, HOLISTART is required. Because at least one holiday lasts more than one day, HOLIDUR (or HOLIFIN) is required.
   holistart sta;
   holivar act;
   holidur dur;
Specify the title.
   title1 'Calendar of Holidays Only';
run;

Output: HTML

The following output shows the December portion of the output. Without the INTERVAL=WORKDAY option, the 5-day Christmas break would be scheduled through the weekend.
Calendar of Holidays Only (December portion)