Chapter Contents

Previous

Next
The CALENDAR Procedure

PROC CALENDAR Statement


PROC CALENDAR <option(s)>;

To do this Use this option
Specify data sets containing

weekly work schedules CALEDATA=

activities DATA=

holidays HOLIDATA=

unique shift patterns WORKDATA=
Control printing

display all months, even if no activities exist FILL

define characters used for outlines, dividers, and so on FORMCHAR=

specify the type of heading for months HEADER=

specify how to show missing values MISSING

suppress the display of Saturdays and Sundays WEEKDAYS
Specify time or duration

specify that START and FIN variables are in DATETIME format DATETIME

specify the number of hours in a standard work day DAYLENGTH=

specify the units of the DUR and HOLIDUR variables INTERVAL=
Control summary information

identify variables in the calendar LEGEND

specify the type of mean to calculate MEANTYPE=


Options

CALEDATA=SAS-data-set
specifies the calendar data set, a SAS data set that contains weekly work schedules for multiple calendars.
Default: If you omit the CALEDATA= option, PROC CALENDAR uses a default work schedule, as described in The Default Calendars .
Tip: A calendar data set is useful if you are using multiple calendars or a nonstandard work schedule.
See also: Calendar Data Set
Featured in: Multiple Schedule Calendars with Atypical Workshifts (Separated Output)

DATA=SAS-data-set
specifies the activities data set, a SAS data set that contains starting dates for all activities and variables to display for each activity. Activities must be sorted or indexed by starting date.
Default: If you omit the DATA= option, the most recently created SAS data set is used.
See also: Activities Data Set
Featured in: All examples. See Examples

DATETIME
specifies that START and FIN variables contain values in DATETIME. format.
Default: If you omit the DATETIME option, PROC CALENDAR assumes that the START and FIN values are in the DATE. format.
Featured in: Multiple Schedule Calendars with Atypical Workshifts (Separated Output)

DAYLENGTH=hours
gives the number of hours in a standard working day. The hour value must be a SAS TIME value.
Default: 24 if INTERVAL=DAY (the default), 8 if INTERVAL=WORKDAY.
Restriction: DAYLENGTH= applies only to schedule calendars.
Interaction: If you specify the DAYLENGTH= option and the calendar data set contains a D_LENGTH variable, PROC CALENDAR uses the DAYLENGTH= value only when the D_LENGTH value is missing.
Interaction: When INTERVAL=DAY and you have no CALEDATA= data set, specifying a DAYLENGTH= value has no effect.
Tip: The DAYLENGTH= option is useful when you use the DUR statement and your work schedule contains days of varying lengths, for example, a 5
1/2-day work week. In a work week with varying day lengths, you need to set a standard day length to use in calculating duration times. For example, an activity with a duration of 3.0 workdays lasts 24 hours if DAYLENGTH=8:00 or 30 hours if DAYLENGTH=10:00.
Tip: Instead of specifying the DAYLENGTH= option, you can specify the length of the working day by using a D_LENGTH variable in the CALEDATA= data set. If you use this method, you can specify different standard day lengths for different calendars.
See also: Calendar Data Set for more information on setting the length of the standard workday

FILL
displays all months between the first and last activity, start and finish dates inclusive, including months that contain no activities.
Default: If you do not specify FILL, PROC CALENDAR prints only months that contain activities. (Months that contain only holidays are not printed.)
Featured in: Schedule Calendar, Blank or with Holidays

FORMCHAR <(position(s))>='formatting-character(s)'
defines the characters to use for constructing the outlines and dividers for the cells in the calendar as well as all identifying markers (such as asterisks and arrows) used to indicate holidays or continuation of activities in PROC CALENDAR output.

position(s)
identifies the position of one or more characters in the SAS formatting-character string. A space or a comma separates the positions.
Default: Omitting (position(s)) is the same as specifying all 20 possible system formatting characters, in order.
Range: PROC CALENDAR uses 17 of the 20 formatting characters that SAS provides. Formatting Characters Used by PROC CALENDAR shows the formatting characters that PROC CALENDAR uses. Formatting Characters in PROC CALENDAR Output illustrates their use in PROC CALENDAR output.

formatting-character(s)
lists the characters to use for the specified positions. PROC CALENDAR assigns characters in formatting-character(s) to position(s), in the order that they are listed. For instance, the following option assigns an asterisk (*) to the twelfth position, assigns a single dash (-) to the thirteenth, and does not alter remaining characters:
formchar(12 13)='*-'
These new settings change the activity line from this:
+=================ACTIVITY===============+
to this:
*------------------ACTIVITY--------------*

Interaction: The SAS system option FORMCHAR= specifies the default formatting characters. The SAS system option defines the entire string of formatting characters. The FORMCHAR= option in a procedure can redefine selected characters.
Tip: You can use any character in formatting-characters, including hexadecimal characters. If you use hexadecimal characters, you must put an x after the closing quote. For instance, the following option assigns the hexadecimal character 2D to the third formatting character, the hexadecimal character 7C to the seventh character, and does not alter the remaining characters:
formchar(3,7)='2D7C'x
See also: For information on which hexadecimal codes to use for which characters, consult the documentation for your hardware.

Formatting Characters Used by PROC CALENDAR
Position Default Used to draw
1 | vertical bar
2 - horizontal bar
3 - cell: upper left corner
4 - cell: upper middle intersection
5 - cell: upper right corner
6 | cell: middle left cell side
7 + cell: middle middle intersection
8 | cell: middle right cell side
9 - cell: lower left corner
10 - cell: lower middle intersection
11 - cell: lower right corner
12 + activity start and finish
13 = activity line
16 / activity separator
18 < activity continuation from
19 > activity continuation to
20 * holiday marker

Formatting Characters in PROC CALENDAR Output

[IMAGE]

HEADER=SMALL | MEDIUM | LARGE
specifies the type of heading to use in printing the name of the month.

SMALL
prints the month and year on one line.

MEDIUM
prints the month and year in a box four lines high.

LARGE
prints the month seven lines high using asterisks (*). The year is included if space is available.

Default: MEDIUM

HOLIDATA=SAS-data-set
specifies the holidays data set, a SAS data set containing the holidays you want to display in the output. One variable must contain the holiday names and another must contain the starting dates for each holiday. PROC CALENDAR marks holidays in the calendar output with asterisks (*) when space permits.
Interaction: Displaying holidays on a calendar requires a holidays data set and a HOLISTART statement. A HOLIVAR statement is recommended for naming holidays. HOLIDUR is required if any holiday lasts longer than one day.
Tip: The holidays data set does not require sorting.
See also: Holidays Data Set
Featured in: All examples. See Examples

INTERVAL=DAY | WORKDAY
specifies the units of the DUR and HOLIDUR variables to one of two default daylengths:

DAY
specifies the values of the DUR and HOLIDUR variables in units of 24-hour days and specifies the default 7-day calendar. For instance, a DUR value of 3.0 is treated as 72 hours. The default calendar work schedule consists of seven working days, all starting at 00:00 with a length of 24:00.

WORKDAY
specifies the values of the DUR and HOLIDUR variables in units of 8-hour days and specifies that the default calendar contains five days a week, Monday through Friday, all starting at 09:00 with a length of 08:00. When WORKDAY is specified, PROC CALENDAR treats the values of the DUR and HOLIDUR variables in units of working days, as defined in the DAYLENGTH= option, the CALEDATA= data set, or the default calendar. For example, if the working day is 8 hours long, a DUR value of 3.0 is treated as 24 hours.

Default: DAY
Interaction: In the absence of a CALEDATA= data set, PROC CALENDAR uses the work schedule defined in a default calendar.
Interaction: The WEEKDAYS option automatically sets the INTERVAL= value to WORKDAY.
See also: Calendars and Multiple Calendars and Calendar Data Set for more information on the INTERVAL= option and the specification of working days; The Default Calendars
Featured in: Schedule Calendar, Blank or with Holidays

LEGEND
prints the names of the variables whose values appear in the calendar. This identifying text, or legend box, appears at the bottom of the page for each month if space permits; otherwise, it is printed on the following page. PROC CALENDAR identifies each variable by name or by label if one exists. The order of variables in the legend matches their order in the calendar.
Restriction: LEGEND applies only to summary calendars.
Interaction: If you use the SUM and MEAN statements, the legend box also contains SUM and MEAN values.
Featured in: Multiple Summary Calendars with Atypical Workshifts (Separated Output)

MEANTYPE=NOBS | NDAYS
specifies the type of mean to calculate for each month.

NOBS
calculates the mean over the number of observations displayed in the month.

NDAYS
calculates the mean over the number of days displayed in the month.

Default: NOBS
Restriction: MEANTYPE= applies only to summary calendars.
Interaction: Normally, PROC CALENDAR displays all days for each month. However, it may omit some days if you use the OUTSTART statement with the OUTDUR or OUTFIN statement.
Featured in: Summary Calendar with MEAN Values By Observation

MISSING
determines how missing values are treated, based on the type of calendar.

Summary Calendar
If there is a day without an activity scheduled, PROC CALENDAR prints the values of variables for that day using the SAS or user-defined format specified for missing values.
Default: If you omit MISSING, days without activities contain no values.

Schedule Calendar
variables with missing values appear in the label of an activity, using the format specified for missing values.
Default: If you do not specify MISSING, PROC CALENDAR ignores missing values in labeling activities.

See also: Missing Values in Input Data Sets for more information on missing values

WEEKDAYS
suppresses the display of Saturdays and Sundays in the output. It also specifies that the value of the INTERVAL= option is WORKDAY.
Default: If you omit WEEKDAYS, the calendar displays all seven days.
Tip: The WEEKDAYS option is an alternative to using the combination of INTERVAL=WORKDAY and the OUTSTART and OUTFIN statements, as shown here:
Illustration of Formatting Characters in PROC CALENDAR Output
proc calendar weekdays; start date; run; proc calendar interval=workday; start date; outstart monday; outfin friday; run;
Featured in: Schedule Calendar with Holidays -- 5-Day Default

WORKDATA=SAS-data-set
specifies the workdays data set, a SAS data set that defines the work pattern during a standard working day. Each numeric variable in the workdays data set denotes a unique workshift pattern during one working day.
Tip: The workdays data set is useful in conjunction with the calendar data set.
See also: Workdays Data Set and Calendar Data Set
Featured in: Multiple Schedule Calendars with Atypical Workshifts (Separated Output)


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.