Calendar Modifications for 445/454/544 Calendars
MICS 445/454/544 Calendar option
micsrm140
Required roles: systems programmer, security administrator, database administrator |
|---|
To operate
MICS
on a calendar system with each calendar quarter composed of a four-week month, four-week month, and five-week month (or 4-5-4 or 5-4-4), consider the following addition to the information provided for Gregorian-based calendar installation.Note:
The MICS Accounting and Chargeback
Product includes facilities for defining a unique accounting calendar separate from the global MICS
calendar definitions. This capability is designed to help you meet your requirements for chargeback and accounting relative to your company's fiscal calendar while continuing to use the standard 12-month calendar for most of your MICS
information. See the MICS Accounting and Chargeback
section for more information before altering the global MICS
calendar.The topics that are relevant when dealing with this type of special accounting calendar are:
- When does the first day of the accounting week begin? For example, Sunday, Monday.
- When does each accounting year begin and end? It must begin at the start of a week and the start of accounting month 1.
- Which accounting year has 53 weeks in it? Generally, there are 52 weeks in a year and then every sixth year there is a 53-week year to adjust for the extra days.
- Which month within the 53-week year has the fifth week? The normal pattern of either 4-4-5, 4-5-4, or 5-4-4 weeks in a quarter of a year must have an extra week in one designated month.
- Which years have starting dates in the same year as the accounting year. For example, starting date of 02JAN01 is in accounting year 2001.
- Which pattern fits your accounting calendar? The patterns are either 4-4-5, 4-5-4, or 5-4-4.
- How many years of data do is it necessary to keep forMICS?
After you have resolved the previous questions, the implementation strategy within
MICS
can be addressed.A. Code the Complex-Level CPLXDEF or Unit-Level Site Parameter Member
If you want to define a global, complex-level special calendar, then code the 13MONTHYEAR parameter in sharedprefix.MICS.PARMS(CPLXDEF) as described here and run sharedprefix.MICS.CNTL(CPLXGEN). The new complex-level special calendar takes effect when you execute the unit-level BASPGEN job.
Otherwise, specify the 13MONTHYEAR parameter in prefix.MICS.PARMS(SITE) to restrict the special calendar to a specific unit.
Code the parameter as, '13MONTHYEAR NO #DWMY=#memname' where memname is your modified member. See Complex Option Definition (CPLXDEF) and Site Characteristics (SITE). 'memname' must exist as a #memname version and as a $memname version if memname begins with the letters DWMY. BASPGEN is coded to include #DWMYxxx from the #BASMSTR module it generates and include $DWMYxxx from the $BASMSTR module it generates. If memname does not begin with DWMY, BASPGEN generates code to include #memname from the #BASMSTR module and from the $BASMSTR module.
For example, memname might be named DWMY445; therefore a # version would exist named #DWMY445 which contains macro definitions that are written in SAS Macro statements and a $ version, $DWMY445, containing corresponding macros written in SAS Macro language would also exist. (You will see later how to code changes for both members).
B. Code the Changes for #memname and $memname
For $memname, modify sharedprefix.MICS.SOURCE($DWMY445). '$memname' contains the date macros that are written with SAS Macro language.
For each year that you need to specify to
MICS
, code a WHEN statement like the ones that are shown here in the SETYRST macro. Provide the start date, the ending date, and the value to set the variable YRSTART to, which is the start date again. Be careful that each start date begins on the first of your defined week and the start of accounting month 1.%MACRO SETYRST; ENDDT = DATEPART(ENDTS); %* MODIFY THE FOLLOWING CODE AS NECESSARY. ; %* INDICATE THE START ; %* OF YEAR AND THE END OF THE SAME YEAR IN ; %* THE FOLLOWING SET OF ; %* STATEMENTS. ; SELECT; WHEN ('02JAN84'D LE ENDDT LE '30DEC84'D ) YRSTART='02JAN84'D; WHEN ('31DEC84'D LE ENDDT LE '29DEC85'D ) YRSTART='31DEC84'D; WHEN ('30DEC85'D LE ENDDT LE '28DEC86'D ) YRSTART='30DEC85'D; WHEN ('29DEC86'D LE ENDDT LE '27DEC97'D ) YRSTART='29DEC86'D; WHEN ('28DEC87'D LE ENDDT LE '25DEC88'D ) YRSTART='28DEC87'D; WHEN ('26DEC88'D LE ENDDT LE '31DEC89'D ) YRSTART='26DEC88'D; WHEN ('01JAN90'D LE ENDDT LE '30DEC90'D ) YRSTART='01JAN90'D; WHEN ('31DEC90'D LE ENDDT LE '29DEC91'D ) YRSTART='31DEC90'D; OTHERWISE DO; CALL MICSLOG('BAS00473'); ABORT ABEND 510; END; END; %MEND SETYRST;
The Macro language statements are:
%MACRO YEAR; %SETYRST; SELECT (YRSTART); WHEN ('02JAN84'D) YEAR = YEAR(YRSTART) - 1900; WHEN ('01JAN90'D) YEAR = YEAR(YRSTART) - 1900; OTHERWISE YEAR = YEAR(YRSTART) - 1899; END; %MEND YEAR;
As shown previously, the year is identified by its start date. The amount of 1900 is subtracted from years that are coded here. This subtraction results in the accounting year being correctly identified for those years in which the start date is in the same year as the accounting year.
Using the example of a fiscal year beginning on January 2, 1984 as coded previously, let's see how this works. If we call this fiscal year 1984, we would want to subtract 1900 because the year of our start date--1984--minus 1900 yields 84. If we decide to call the fiscal year 1985, we would subtract 1899 because the start date year of 1984 minus 1899 yields 85.
Since our logic is designed to do this as the normal course of action, we would have omitted 02JAN84 from the SELECT statement. The real intent here is to arrive at a value which, when subtracted from the year of the start date of each fiscal year that we have specified to
MICS
, result in the year that we intend to have the fiscal year named.The code that is shown here pertains to defining which year has 53 weeks.
%MACRO MONTH; %YEAR; TEMPDAY = ENDDT + 1 - YRSTART; %* MODIFY THE FOLLOWING CODE AS NECESSARY. EACH 53; %* WEEK YEAR MUST BE CODED IN THIS CHECK. THE; %* SPECIAL FORMAT THAT USES 371 DAYS WILL BE USED FOR; %* A 53 WEEK YEAR. THE EXAMPLE SHOWS 1989 AS THE 53; %* WEEK YEAR ; SELECT (YEAR); WHEN (89) MTHDAYS=PUT(TEMPDAY,YR455WK.); %* 1989 IS 53-WEEK YEAR ; OTHERWISE MTHDAYS=PUT(TEMPDAY,YR445WK.); END; MONTH = INPUT(SUBSTR(MTHDAYS,1,2),2.); %MEND MONTH;
There are 52 weeks in a year and then every sixth year there is a 53-week year to adjust for the extra days. This implementation in
MICS
consists of creating two formats in the sharedprefix.MICS.LOAD library to be used by the exit coding. The first format, labeled YR445WK, is to be used with the 52-week year. The second format, labeled YR455WK, is to be used with the 53-week year. In our previous code example, 1989 is a 53-week year and is formatted using the 53-week format YR455WK. The YR445WK and YR455WK formats are defined in Step C.The code that is shown here uses the YR445WK and YR455WK formats in a way similar to the MONTH macro logic. The ordinal number of a day within a year defines the start day of the month in which the day lies. The difference between ordinal year day and month start day is DAY (of month).
%MACRO DAY; %YEAR; TEMPDAY = ENDDT + 1 - YRSTART; %* MODIFY THE FOLLOWING CODE AS NECESSARY. EACH 53; %* WEEK YEAR MUST BE CODED IN THIS CHECK. THE; %* SPECIAL FORMAT THAT USES 371 DAYS WILL BE USED; %* FOR A 53 WEEK YEAR. THE EXAMPLE SHOWS 1989 AS; %* THE 53 WEEK YEAR; SELECT (YEAR); WHEN (89) MTHDAYS=PUT(TEMPDAY,YR455WK.); %* 1989 IS 53-WEEK YEAR ; OTHERWISE MTHDAYS=PUT(TEMPDAY,YR445WK.); END; DAY = TEMPDAY - INPUT(SUBSTR(MTHDAYS,3,3),3.); %MEND DAY;
Example:
This is an example of the coded $DWMY445 that uses a 4- 4-5 accounting calendar. The first year starts on 02JAN84 and ends on 30DEC84. Each week begins on Monday. The accounting year that has 53 weeks is 1989. The 11th month has the extra week in the 53-week year. The two years in the sample that begin in the same year as the accounting year have the starting dates of 02JAN84 and 01JAN90.
%LET WKSTART=2; %LET MONTHDF=12; %MACRO SETYRST; ENDDT = DATEPART(ENDTS); SELECT; WHEN ('02JAN84'D LE ENDDT LE '30DEC84'D ) YRSTART='02JAN84'D; WHEN ('31DEC84'D LE ENDDT LE '29DEC85'D ) YRSTART='31DEC84'D; WHEN ('30DEC85'D LE ENDDT LE '28DEC86'D ) YRSTART='30DEC85'D; WHEN ('29DEC86'D LE ENDDT LE '27DEC97'D ) YRSTART='29DEC86'D; WHEN ('28DEC87'D LE ENDDT LE '25DEC88'D ) YRSTART='28DEC87'D; WHEN ('26DEC88'D LE ENDDT LE '31DEC89'D ) YRSTART='26DEC88'D; WHEN ('01JAN90'D LE ENDDT LE '30DEC90'D ) YRSTART='01JAN90'D; WHEN ('31DEC90'D LE ENDDT LE '29DEC91'D ) YRSTART='31DEC90'D; OTHERWISE DO; CALL MICSLOG('BAS00473'); ABORT ABEND 510; END; END; %MEND SETYRST; %MACRO YEAR; %SETYRST; SELECT (YRSTART); WHEN ('02JAN84'D) YEAR = YEAR(YRSTART) - 1900; WHEN ('01JAN90'D) YEAR = YEAR(YRSTART) - 1900; OTHERWISE YEAR = YEAR(YRSTART) - 1899; END; %MEND YEAR; %MACRO MONTH; %YEAR; TEMPDAY = ENDDT + 1 - YRSTART; SELECT (YEAR); WHEN (89) MTHDAYS=PUT(TEMPDAY,YR455WK.); %* 1989 IS 53-WEEK YEAR ; OTHERWISE MTHDAYS=PUT(TEMPDAY,YR445WK.); END; MONTH = INPUT(SUBSTR(MTHDAYS,1,2),2.); %MEND MONTH; %MACRO DAY; %YEAR; TEMPDAY = ENDDT + 1 - YRSTART; SELECT (YEAR); WHEN (89) MTHDAYS=PUT(TEMPDAY,YR455WK.); %* 1989 IS 53-WEEK YEAR ; OTHERWISE MTHDAYS=PUT(TEMPDAY,YR445WK.); END; DAY = TEMPDAY - INPUT(SUBSTR(MTHDAYS,3,3),3.); %MEND DAY;
For #memname (which contains the date macros that are written with SAS Macro statements), the modifications to the default member sharedprefix.MICS.SOURCE($DWMY445) you have completed copy #memname to sharedprefix.MICS.SOURCE(#DWMY445) and modified to the SAS Macro statement style.
Here is an example of the coded #DWMY445 that is the SAS Macro statement version of the $DWMY445 member we coded in the earlier example.
MACRO _WKSTART 2 % MACRO _MONTHDF 12 % MACRO _SETYRST; ENDDT = DATEPART(ENDTS); SELECT; WHEN ('02JAN84'D LE ENDDT LE '30DEC84'D ) YRSTART='02JAN84'D; WHEN ('31DEC84'D LE ENDDT LE '29DEC85'D ) YRSTART='31DEC84'D; WHEN ('30DEC85'D LE ENDDT LE '28DEC86'D ) YRSTART='30DEC85'D; WHEN ('29DEC86'D LE ENDDT LE '27DEC97'D ) YRSTART='29DEC86'D; WHEN ('28DEC87'D LE ENDDT LE '25DEC88'D ) YRSTART='28DEC87'D; WHEN ('26DEC88'D LE ENDDT LE '31DEC89'D ) YRSTART='26DEC88'D; WHEN ('01JAN90'D LE ENDDT LE '30DEC90'D ) YRSTART='01JAN90'D; WHEN ('31DEC90'D LE ENDDT LE '29DEC91'D ) YRSTART='31DEC90'D; OTHERWISE DO; CALL MICSLOG('BAS00473'); ABORT ABEND 510; END; END; MACRO _YEAR _SETYRST SELECT (YRSTART); WHEN ('02JAN84'D) YEAR = YEAR(YRSTART) - 1900; WHEN ('01JAN90'D) YEAR = YEAR(YRSTART) - 1900; OTHERWISE YEAR = YEAR(YRSTART) - 1899; END; MACRO _MONTH _YEAR TEMPDAY = ENDDT + 1 - YRSTART; SELECT (YEAR); WHEN (89) MTHDAYS=PUT(TEMPDAY,YR455WK.); %* 1989 IS 53-WEEK YEAR ; OTHERWISE MTHDAYS=PUT(TEMPDAY,YR445WK.); END; MONTH = INPUT(SUBSTR(MTHDAYS,1,2),2.); MACRO _DAY _YEAR TEMPDAY = ENDDT + 1 - YRSTART; SELECT (YEAR); WHEN (89) MTHDAYS=PUT(TEMPDAY,YR455WK.); %* 1989 IS 53-WEEK YEAR ; OTHERWISE MTHDAYS=PUT(TEMPDAY,YR445WK.); END; DAY = TEMPDAY - INPUT(SUBSTR(MTHDAYS,3,3),3.); %
C. Generating and Loading the YRWK445 and YR455WK formats
The implementation in
MICS
consists of creating two PROC FORMATs into the sharedprefix.MICS.MCOLIB library to be used by the exit coding. The two PROC FORMATs that are provided use a 4-4-5 accounting calendar. The first format, labeled YR445WK, is to be used with the 52-week year. The second format, labeled YR455WK, is to be used with the 53-week year.If you need a pattern other than a 4-4-5 week pattern, then the day ranges must be adjusted to fit the other patterns of 4-5-4 or 5-4-4 weeks in an accounting calendar. The YR445WK and YR455WK PROC FORMATs in the sample coding show a range of values for the number of days in a month (for example, 1-28). The label value in the PROC FORMATs shows the month followed by the number of days from the beginning of the year (for example, '01000'). The first line of the YR445WK PROC FORMAT sample is:
1-28 = '01000'
It shows that days 1-28 are in month 01 and there are 000 days from the start of the year to the first day of month 01. Both the YR445WK and YR455WK PROC FORMATs must be adjusted if you are going to use a 4-5-4 or 5-4-4 accounting calendar. The YR455WK PROC FORMAT must be adjusted if the 11th month is not used for the extra week in the 53-week year. The formats can be built with a SAS batch job. To build the format in batch:
//... JOB ....... /*PROCLIB DSN=sharedprefix.MICS.PROCLIB // EXEC MICSNDBx /* Where x is the db identifier */ //SYSIN DD * PROC FORMAT PRINT DDNAME=MCOLIB.USERFMT1; VALUE YR445WK 1-28 = '01000' 29-56 = '02028' 57-91 = '03056' 92-119 = '04091' 120-147 = '05119' 148-182 = '06147' 183-210 = '07182' 211-238 = '08210' 239-273 = '09238' 274-301 = '10273' 302-329 = '11301' 330-364 = '12329' OTHER = 'UNKWN'; PROC FORMAT PRINT DDNAME=MCOLIB.USERFMT1; VALUE YR455WK 1-28 = '01000' 29-56 = '02028' 57-91 = '03056' 92-119 = '04091' 120-147 = '05119' 148-182 = '06147' 183-210 = '07182' 211-238 = '08210' 239-273 = '09238' 274-301 = '10273' 302-336 = '11301' 337-371 = '12336' OTHER = 'UNKWN'; RUN;
D. Implementing the Changes
There are two alternatives that can be used to make the exit coding available to the
MICS
daily processing. Choose one of the alternatives that are based on your requirements and situation. In either case, add the indicated code with any revisions that are necessary to the sharedprefix.MICS.SOURCE library as a new member. As the implementation date of the new date routines into an existing system has multiple considerations, consult the Broadcom Support
. Use either Alternative I or Alternative II to implement the DWMY445 routines.Alternative I: To Add the New Dare Routine to One Unit at a Time
- After you have completed parts AD, add the following SAS statement before the MACRO _WKSTART statement in #DWMY445 and before the %MACRO WKSTART statement in $DWMY445:%INCLUDE SOURCE(#DWMY12); in the #DWMY445 member %INCLUDE SOURCE($DWMY12); in the $DWMY445 member
- The #DWMY445 and $DWMY445 members must be added to the sharedprefix.MICS.SOURCE library with the modifications that you made.
- Run BASPGEN from the prefix.MICS.CNTL library. Ensure that there are no errors in MICSLOG and that the job completes with a condition code of zero.Run BASPGEN for every database unit.After you have added the DWMY445 modules to the source library and run a BASPGEN, you can run aMICS DAILY. The YEAR, MONTH, WEEK, and DAY fields should be reviewed for validity after the Daily processing.
Alternative II: Add to All Units Simultaneously
This implementation adds the new date routine to all the units simultaneously, and is used by sites that have previously used the #DWMY12 member or taken the default sharedprefix.MICS.PARMS(CPLXDEF) member and the default prefix.MICS.PARMS(SITE) member.
Add the DWMY445 members into sharedprefix.MICS.SOURCE with the modifications that you have made.
- After you have completed parts B - D, add the following SAS statement to #DWMY12 and $DWMY12 in the sharedprefix.MICS.SOURCE library:%INCLUDE SOURCE(#DWMY445); for the #DWMY12 member %INCLUDE SOURCE($DWMY445); for the $DWMY12 member
- The #DWMY445 and $DWMY445 members must be added to the sharedprefix.MICS.SOURCE library with the modifications that you made.
- Run BASPGEN from the prefix.MICS.CNTL library. Ensure that there are no errors in MICSLOG and that the job completes with a condition code of zero.Run BASPGEN for every database unit.Your next Daily will reflect the new date routines and the YEAR, MONTH, WEEK, and DAY fields should be reviewed for validity.