Resources

Exporting Calendars and Holidays (mspsae07)

/***************************************************************/
/*                                                             */
/*             S A S   S A M P L E   L I B R A R Y             */
/*                                                             */
/*    NAME: mspsae07                                           */
/*   TITLE: Exporting Calendars and Holidays (mspsae07)        */
/* PRODUCT: OR                                                 */
/*  SYSTEM: ALL                                                */
/*    KEYS: OR                                                 */
/*   PROCS: PM, SAS/ACCESS                                     */
/*    DATA:                                                    */
/*                                                             */
/* SUPPORT:                             UPDATE:                */
/*     REF:                                                    */
/*    MISC: Example 7 from the The Microsoft Project           */
/*          Conversion Macros chapter of Project Management    */
/*                                                             */
/***************************************************************/



/***************************************************************

 This example illustrates the capability of the macro to handle
 multiple calendars within a project. The project has each
 activity 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.

 ***************************************************************/


/***************************************************************
 In this example we use a file reference mspref to specify
 the path and file name of the mdb file to be created by the
 macro %SASTOMSP.

 filename mspref "C:\MSPROJ\sasmsp3.mdb";

 You may want to change it to a file name you want.
 If you don't define mspref as a sas file reference, a file
 mspref.mdb will be created in the default path of the OUTFILE=
 option of PROC EXPORT. In many cases, this default path is
 'C:\Documents and Settings\username\'. See the documentation
 for details.

 ***************************************************************/


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
;

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  .  .
;

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;

%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)