The Microsoft Project Conversion Macros


Example 6.7 Exporting Calendars and Holidays

This example demonstrates the capability of the %SASTOMSP macro to handle multiple calendars within a project. Each activity is associated with one of four available calendars. Each calendar is customized to incorporate various workday shift patterns. In addition, there is a holiday data set that is also appropriately associated with a calendar. The four different calendars are defined as follows:

  • The DEFAULT calendar has five eight-hour days (Monday through Friday) and holidays on Saturday and Sunday.

  • The calendar OVT_CAL specifies an overtime calendar that has 10-hour workdays on Monday through Friday, a half-day on Saturday, and a holiday on Sunday.

  • The calendar PROD_CAL follows a more complicated work pattern: Sunday is a holiday; on Monday work is done from 8 a.m. through midnight with a two hour break from 6 p.m. to 8 p.m.; on Tuesday through Friday work is done round the clock with two 2-hour breaks, one from 6 a.m to 8 a.m and the other from 6 p.m. to 8 p.m.; on Saturday the work shifts are from midnight to 6 a.m. and again from 8 a.m. to 6 p.m.

  • The calendar ENG_CAL is specified similar to the default calendar, but with an extra vacation period of 7 days beginning on December 8.

The following data set contains the activity information:

data actdat;
   format activities $12. s1-s3 $12. cal $8.;
   input activities & days s1 & s2 & s3 & cal &;
   datalines;
Approve Plan   5  Drawings      Study Market  Write Specs  DEFAULT
Drawings      10  Prototype     .             .            DEFAULT
Study Market   5  Mkt. Strat.   .             .            DEFAULT
Write Specs    5  Prototype     .             .            ENG_CAL
Prototype     15  Materials     Facility      .            OVT_CAL
Mkt. Strat.   10  Test Market   Marketing     .            DEFAULT
Materials     10  Init. Prod.   .             .            DEFAULT
Facility      10  Init. Prod.   .             .            DEFAULT
Init. Prod.   10  Test Market   Marketing     Evaluate     DEFAULT
Evaluate      10  Changes       .             .            DEFAULT
Test Market   15  Changes       .             .            DEFAULT
Changes        5  Production    .             .            DEFAULT
Production     0  .             .             .            PROD_CAL
Marketing      0  .             .             .            DEFAULT
;

The next three data sets specify the work shift patterns, calendars, and holidays, respectively:

data wrkdat;
   input fullday time8. halfday time8. ovtday time8.
         d1 time8. d2 time8. d3 time8.;
   format fullday halfday ovtday d1 d2 d3 time6.;
   datalines;
08:00   08:00   08:00   .       08:00   .
16:00   12:00   18:00   06:00   18:00   06:00
.       .       .       08:00   20:00   08:00
.       .       .       18:00   .       18:00
.       .       .       20:00   .       .
.       .       .       .       .       .
;
data caldat;
   input  cal $ _sun_ $ _mon_$ _tue_$  _wed_$ _thu_$ _fri_$ _sat_ $;
   datalines;
DEFAULT  holiday fullday fullday fullday fullday fullday holiday
OVT_CAL  holiday ovtday  ovtday  ovtday  ovtday  ovtday  halfday
PROD_CAL holiday d2      d1      d1      d1      d1      d3
ENG_CAL  .       .       .       .       .       .       .
;
data holdat;
   format holiday holifin date7.;
   input holiday & date7. holifin & date7. holidur cal $;
   datalines;
08Dec06  .        7  ENG_CAL
24Dec06  26Dec06  .  .
01Jan07  01Jan07  .  .
;

You can view the resulting project schedule in the PM window with the following call:

proc pm date='01Dec06'd data=actdat
    calendar=caldat holidata=holdat
    workday=wrkdat      
    daylength='08:00't;
    activity activities;
    duration days;
    successor s1 s2 s3;
    calid cal;
    holiday holiday / holifin = holifin holidur=holidur;   
run;

The resulting PM window is shown in Output 6.7.1.

Output 6.7.1: PM Window

PM Window


To convert the preceding data to an MDB file that includes the calendar and holiday information, you can use the following call to %SASTOMSP:

%sastomsp(mdbfile=mspref,
          actds=actdat, calds=caldat,
          holds=holdat, workds=wrkdat,
          _date='1Dec06'd,
          _daylength='08:00't,
          _activity=activities,
          _dur=days,
          _successor=s1 s2 s3,
          _calid=cal,
          _holistart=holiday, _holiend=holifin, _holidur=holidur)

The resulting MS Project Window is shown in Output 6.7.2. The schedule is the same as the one produced by the PM procedure.

Output 6.7.2: MS Project Window

MS Project Window