The CALENDAR Procedure |
Procedure features: |
| |||||||||||||||||
Data sets: |
|
This example
produces a schedule calendar
schedules activities around holidays
uses separate work patterns and holidays for each calendar
uses an 8-hour day, 5 1/2-day work week
displays and identifies multiple calendars on each calendar page (combined output)
displays but does not identify multiple calendars on each calendar page (mixed output).
Two Programs and Two Pieces of Output |
This example creates both combined and mixed output. Producing combined or mixed calendar output requires only one change to a PROC CALENDAR step: the setting of the OUTPUT= option in the CALID statement. Combined output is produced first, then mixed output.
Producing Different Output for Multiple Calendars |
This example and Multiple Schedule Calendars with Atypical Work Shifts (Separated Output) use the same input data for multiple calendars to produce different output. The only differences in these programs are how the activities data set is sorted and how the OUTPUT= option is set.
Program for Combined Calendars |
libname well 'SAS-library'; |
proc sort data=well.act; by date; run; |
options nodate pageno=1 linesize=132 pagesize=60; |
proc calendar data=well.act holidata=well.hol caledata=well.cal workdata=well.wor datetime; |
calid _cal_ / output=combine; |
start date; dur dur; |
holistart date; holivar holiday; |
title1 'Well Drilling Work Schedule: Combined Calendars'; format cost dollar9.2; run; |
Output for Combined Calendars |
Multiple Schedule Calendars with Atypical Work Shifts (Combined Output)
Well Drilling Work Schedule: Combined Calendars 1 ------------------------------------------------------------------------------------------------------------------------ | | | July 1996 | | | |----------------------------------------------------------------------------------------------------------------------| | Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | ----------+----------------+----------------+----------------+----------------+----------------+----------------+----------------| | | | 1 | 2 | 3 | 4 | 5 | 6 | |.........|................|................|................|................|................|................|................| | CAL1 | | | | |**Independence**|+Assemble Tank/>| | | | | | | | |+Lay Power Line>| | | | |+==============Drill Well/$1,000.00==============>| |<Drill Well/$1,+| | |.........|................|................|................|................|................|................|................| | CAL2 | | | |+=======================Excavate/$3,500.00========================>| |---------+----------------+----------------+----------------+----------------+----------------+----------------+----------------| | | 7 | 8 | 9 | 10 | 11 | 12 | 13 | |.........|................|................|................|................|................|................|................| | CAL1 | |+===================Build Pump House/$2,000.00====================+| | | | | |<=====================Assemble Tank/$1,000.00=====================+| | | | | |<===Lay Power Line/$2,000.00====+| |+===Pour Foundation/$1,500.00===>| | |.........|................|................|................|................|................|................|................| | CAL2 | |<Excavate/$3,50>|****Vacation****|<Excavate/$3,50+| | | | |---------+----------------+----------------+----------------+----------------+----------------+----------------+----------------| | | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |.........|................|................|................|................|................|................|................| | CAL1 | |+===============================Install Pump/$500.00===============================+| | | | |<===========Pour Foundation/$1,500.00============+| |+Install Pipe/$>| | | | | | | | | | | | | | | | | | | | | | | | | | | | | |---------+----------------+----------------+----------------+----------------+----------------+----------------+----------------| | | 21 | 22 | 23 | 24 | 25 | 26 | 27 | |.........|................|................|................|................|................|................|................| | CAL1 | |+==============================Erect Tower/$2,500.00===============================>| | | | |<====Install Pipe/$1,000.00=====+| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |---------+----------------+----------------+----------------+----------------+----------------+----------------+----------------| | | 28 | 29 | 30 | 31 | | | | |.........|................|................|................|................|................|................|................| | CAL1 | |<Erect Tower/$2+| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------------------------------------------------------------------------------------------------------------
Program for Mixed Calendars |
To produce mixed output instead of combined, use the same program and change the setting of the OUTPUT= option to OUTPUT=MIX:
proc calendar data=well.act holidata=well.hol caledata=well.cal workdata=well.wor datetime; calid _cal_ / output=mix; start date; dur dur; holistart date; holivar holiday; outstart Monday; outfin Saturday; title1 'Well Drilling Work Schedule: Mixed Calendars'; format cost dollar9.2; run;
Output for Mixed Calendars |
Multiple Schedule Calendar with Atypical Work Shifts (Mixed Output)
Well Drilling Work Schedule: Mixed Calendars 1 ------------------------------------------------------------------------------------------------------------------------------- | | | July 1996 | | | |-----------------------------------------------------------------------------------------------------------------------------| | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | |--------------------+--------------------+--------------------+--------------------+--------------------+--------------------| | 1 | 2 | 3 | 4 | 5 | 6 | | | | | | | | | | | | | | | | | | | |+Assemble Tank/$1,0>| | | | |+===============================Excavate/$3,500.00================================>| |+==================Deliver Material/$500.00==================+|****Independence****|+Lay Power Line/$2,>| | |+====================Drill Well/$1,000.00====================>|****Independence****|<Drill Well/$1,000.+| | |--------------------+--------------------+--------------------+--------------------+--------------------+--------------------| | 8 | 9 | 10 | 11 | 12 | 13 | | | | | | | | | | | | | | | |+===========================Build Pump House/$2,000.00============================+| | | |<=============================Assemble Tank/$1,000.00=============================+| | | |<=======Lay Power Line/$2,000.00========+| | | | | |<Excavate/$3,500.00>|******Vacation******|<Excavate/$3,500.00+|+=======Pour Foundation/$1,500.00=======>| | |--------------------+--------------------+--------------------+--------------------+--------------------+--------------------| | 15 | 16 | 17 | 18 | 19 | 20 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |+=========================================Install Pump/$500.00=========================================+| | |<=================Pour Foundation/$1,500.00==================+| |+Install Pipe/$1,00>| | |--------------------+--------------------+--------------------+--------------------+--------------------+--------------------| | 22 | 23 | 24 | 25 | 26 | 27 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |+========================================Erect Tower/$2,500.00=========================================>| | |<========Install Pipe/$1,000.00=========+| | | | | |--------------------+--------------------+--------------------+--------------------+--------------------+--------------------| | 29 | 30 | 31 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |<Erect Tower/$2,500+| | | | | | -------------------------------------------------------------------------------------------------------------------------------
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.