CALENDAR Procedure

Example 1: Schedule Calendar with Holidays: 5-Day Default

Features:
PROC CALENDAR statement options:
DATA=
HOLIDATA=
WEEKDAYS
Other statements:
DUR statement
HOLISTART statement
HOLIVAR statement
HOLIDUR statement
START statement
Other features:
PROC SORT statement
BY statement
5-day default calendar

Details

This example does the following:
  • creates a schedule calendar
  • uses one of the two default work patterns: 8-hour day, 5-day week
  • schedules activities around holidays
  • displays a 5-day week

Program

data allacty;
   input date : date7. event $ 9-36 who $ 37-48 long;
   datalines;
01JUL02 Dist. Mtg.                  All          1
17JUL02 Bank Meeting                1st Natl     1
02JUL02 Mgrs. Meeting               District 6   2
11JUL02 Mgrs. Meeting               District 7   2
03JUL02 Interview                   JW           1
08JUL02 Sales Drive                 District 6   5
15JUL02 Sales Drive                 District 7   5
08JUL02 Trade Show                  Knox         3
22JUL02 Inventors Show              Melvin       3
11JUL02 Planning Council            Group II     1
18JUL02 Planning Council            Group III    1
25JUL02 Planning Council            Group IV     1
12JUL02 Seminar                     White        1
19JUL02 Seminar                     White        1
18JUL02 NewsLetter Deadline         All          1
05JUL02 VIP Banquet                 JW           1
19JUL02 Co. Picnic                  All          1
16JUL02 Dentist                     JW           1
24JUL02 Birthday                    Mary         1
25JUL02 Close Sale                  WYGIX Co.    2
;
data hol;
   input date : date7. holiday $ 11-25 holilong @27;
   datalines;
05jul02   Vacation        3
04jul02   Independence    1
;
proc sort data=allacty;
   by date;
run;
options formchar="|----|+|---+=|-/\<>*";
proc calendar data=allacty holidata=hol weekdays;
   start date;
   dur long;
   holistart date;
   holivar holiday;
   holidur holilong;
   title1 'Summer Planning Calendar:  Julia Cho';
   title2 'President, Community Bank';
run;

Program Description

Create the activities data set. ALLACTY contains both personal and business activities information for a bank president.
data allacty;
   input date : date7. event $ 9-36 who $ 37-48 long;
   datalines;
01JUL02 Dist. Mtg.                  All          1
17JUL02 Bank Meeting                1st Natl     1
02JUL02 Mgrs. Meeting               District 6   2
11JUL02 Mgrs. Meeting               District 7   2
03JUL02 Interview                   JW           1
08JUL02 Sales Drive                 District 6   5
15JUL02 Sales Drive                 District 7   5
08JUL02 Trade Show                  Knox         3
22JUL02 Inventors Show              Melvin       3
11JUL02 Planning Council            Group II     1
18JUL02 Planning Council            Group III    1
25JUL02 Planning Council            Group IV     1
12JUL02 Seminar                     White        1
19JUL02 Seminar                     White        1
18JUL02 NewsLetter Deadline         All          1
05JUL02 VIP Banquet                 JW           1
19JUL02 Co. Picnic                  All          1
16JUL02 Dentist                     JW           1
24JUL02 Birthday                    Mary         1
25JUL02 Close Sale                  WYGIX Co.    2
;
Create the holidays data set.
data hol;
   input date : date7. holiday $ 11-25 holilong @27;
   datalines;
05jul02   Vacation        3
04jul02   Independence    1
;
Sort the activities data set by the variable that contains the starting date. You are not required to sort the holidays data set.
proc sort data=allacty;
   by date;
run;
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 schedule calendar. DATA= identifies the activities data set; HOLIDATA= identifies the holidays data set. WEEKDAYS specifies that a week consists of five eight-hour work days.
proc calendar data=allacty holidata=hol weekdays;
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 date;
   dur long;
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 is required.
   holistart date;
   holivar holiday;
   holidur holilong;
Specify the titles.
   title1 'Summer Planning Calendar:  Julia Cho';
   title2 'President, Community Bank';
run;

Output: HTML

Summer Planning Calendar: Julia Cho