Thirteen Month Calendar Modifications
When operating
MICS
on a 13-month year, consider the following information in addition to the information provided for Gregorian-based calendar installations.micsrm140
When operating
MICS
on a 13-month year, consider the following information in addition to the information provided for Gregorian-based calendar installations.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 the majority of your MICS
information. For more information before altering the global MICS
calendar, see Using Accounting and Chargeback.For
MICS
to summarize and store data in a manner consistent with your 13-month year, provide MICS
with information about your fiscal calendar. While you see later how to specify this information, in general determine:- When each fiscal year begins
- Whether the fiscal year is the same year as the Gregorian calendar year
- How many years of data you need to keep
- What you call each of the 13 months, henceforth referred to as periods
MICS
uses this information to arrive at proper Gregorian-to-13-month date conversion routines that enable it to summarize and store data consistent with your fiscal calendar. It is your responsibility to ensure that your 13MONTHYEAR parameter statements and any related SAS code are maintained correctly into the future.To implement a 13-month fiscal calendar in
MICS
, answer the following questions.- When does each fiscal year begin?Ask those in your organization who established or maintain the 13-month calendar your enterprise utilizes. The dates that you specify toMICSis the same dates that your Accounting or Financial departments use to describe the year. This information is used to code the complex-level shareprefix.MICS.PARMS(CPLXDEF) or unit-level prefix.MICS.PARMS(SITE) member, and also to generate a format that is used inMICSprocessing and by some management support applications like theMICS Capacity PlannerandMICS Accounting and Chargeback.
- Is the fiscal year the same as the Gregorian year?The answer to this question directly affects the kinds of modifications you need to make to implement your calendar system inMICS.An example illustrates how you determine the answer to this question. Suppose that your installation has a year that begins on January 1, 1996. The question to ask is "Is the fiscal year 1996 or is it 1997?"
- How many years of data need to be kept?For more information, see Calendar Derivations.
- What is each period (month) named?MICSuses a SAS format, MNTHFMT, to provide the full name of a month from a number. See Site Characteristics (SITE). Many 13-month installations call their 13 periods P01 through P13. This strategy sufficiently differentiates among the periods and eliminates confusing 13-month periods with Gregorian months. Whatever strategy you adopt to call the periods, they should be unique in the first three characters of the name.
Once the determinations are made, you are ready to make the necessary specifications and modifications to
MICS
. For implementing 13-month fiscal calendars in MICS
, the process is:- Code the complex-level cplxdef or unit-level site parameter memberIf 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 YES #DWMY=#memname ddmonyy ddmonyy...Where:#memnameYour modified member that begins with #DWMY or $DWMYddmonyyStart date for each of the 13-month years. See Complex Option Definition (CPLXDEF) and Site Characteristics (SITE).Do not code more than eight years on this statement. Your #memname routine may handle more than eight years, but because this parameter handles only 8, it must be updated in the future.BASPGEN is coded to include #DWMYxxx and $DWMYxxx from the #BASMSTR and $BASMSTR modules it generates, respectively. If '#memname' does not begin with #DWMY, BASPGEN generates code to include #memname from the #BASMSTR and $BASMSTR modules.Proceed through the rest of this checklist and at Step 6, Generating and Loading the YRSTART Format, "Redefine" the years (create your own YRSTART format).
- Code the changes for #memname AND $memname
- The modifications to the default member sharedprefix.MICS.SOURCE(#DWMY13) for #memname (which contains the date macros that are written with SAS MACRO statements) are shown here.The highlighted line of code in the YEAR macro is changed according to your site's fiscal year start date. To decide what value to code, use the following technique:Note:If the fiscal year begins on January 1, 1996, and your site calls this fiscal year 1997, subtract 1899 in the YEAR macro because the year of the start date (1996) minus 1899 yields 97. If the fiscal year begins on January 1, 1996, and your site calls this fiscal year 1996, subtract 1900 because the start date year (1996) minus 1900 yields 96.To rewrite the YEAR macro, use one of the following techniques:Code SELECT statements. For example:MACRO _YEAR _SETYRST SELECT; WHEN (YRSTART EQ '01JAN96'D) SUBYEAR=1899; WHEN (YRSTART EQ '01JAN97'D) SUBYEAR=1899; WHEN (YRSTART EQ '01JAN98'D) SUBYEAR=1899; WHEN (YRSTART EQ '30DEC98'D) SUBYEAR=1898; WHEN (YRSTART EQ '01JAN99'D) SUBYEAR=1898; OTHERWISE DO; FILE LOG; PUT '>ERR> ' YRSTART DATE9. ' NOT IN DEFINED in #DWMY13.'; ABORT ABEND 510; END; END; YEAR=YEAR(YRSTART)-SUBYEAR; %Specify start dates for our fiscal years where the previous example has coded the SAS DATE constants.SAS SELECT logic enables you to specify each of the years individually, providing a form of documentation that, as a System Administrator, you may find helpful.Use "IF" or "IF-THEN-ELSE" logic.If, for instance, all the years that you defined have the same number that is subtracted from them to arrive at the fiscal year, then the only modification would be to the line containing 1900 as discussed previously.If only one year that is required for subtracting a different amount than all others, consider coding a statement that identifies that year and takes an action; it does something different for all other years.DEFAULT #DWMY13 MEMBER SHIPPED WITH CA MICSNote:Annotations to logic are shown by <== indicating the area for comment, and end in !! for separation. These annotations are not SAS code./* **************************************************** */ MACRO _MONTHDF 13% MACRO _DAY _SETYRST DAY=MOD(ENDDT-YRSTART+1,28); IF DAY=0 THEN DAY=28; IF ENDDT-YRSTART>363 THEN DAY=ENDDT-YRSTART-335; % MACRO _WEEK _SETYRST IF WEEKDAY(YRSTART)-_WKSTART >= 0 THEN WEEK=INT((ENDDT-YRSTART+WEEKDAY(YRSTART) -_WKSTART)/7+1); ELSE WEEK=INT((ENDDT-YRSTART+WEEKDAY(YRSTART) -_WKSTART+7)/7+1); % MACRO _MONTH _SETYRST MONTH=INT((ENDDT-YRSTART+1)/28); IF MOD((ENDDT-YRSTART+1),28) NE 0 THEN MONTH=MONTH+1; IF MONTH>13 THEN MONTH=13; % MACRO _YEAR _SETYRST YEAR=YEAR(YRSTART)-1900; <== changes here!! % MACRO _SETYRST ENDDT=DATEPART(ENDTS); YRSTART=INPUT(PUT(ENDDT,YRSTART.),5.); IF YRSTART=. THEN DO; FILE LOG; PUT '>ERR> ' ENDDT DATE9. ' NOT IN DEFINED YEARS.'/ '>>>>> START OF YEAR LIST MUST BE UPDATED IN '/ 'MICS.PARMS(SITE) PARAMETER "13MONTHYEAR" AND '/ 'BASPGEN JOB RUN.'; ABORT ABEND 510; END; % MACRO _PREVWK /* SELECT ONLY DATA FROM THE PREVIOUS WEEK. */ /* CALCULATE PREVIOUS WEEK BY SUBTRACTING 1 */ /* FROM THE WEEK VALUE OF TODAY. */ /* (USING THE _WEEK MACRO). IF AFTER SUBTRACTION */ /* THE WEEK IS FOUND TO BE ZERO, */ /* (THIS WILL HAPPEN THE FIRST WEEK OF THE YEAR), */ /* THE WEEK OF */ /* THE LAST DAY OF THE PREVIOUS YEAR IS USED. */ RETAIN PREVWK; DROP PREVWK; IF PREVWK=. THEN DO; /* H_WEEK IS USED TO HOLD THE WEEK VALUE OF */ /* THE CURRENT OBSERVATION */ /* WHILE THE PREVIOUS WEEK IS BEING CALCULATED */ H_TS=ENDTS; H_WEEK=WEEK; ENDTS=DHMS(TODAY(),0,0,0); _WEEK PREVWK=WEEK-1; IF PREVWK=0 THEN DO; ENDTS=DHMS(YRSTART-1,0,0,0); _WEEK; PREVWK=WEEK; END; ENDTS=H_TS; WEEK=H_WEEK; END; IF WEEK = PREVWK; %
- For $memname (which contains the date macros that are written in SAS Macro language), the code that is illustrated here illustrates the situation that was described previously for the #memname case.%MACRO YEAR; %SETYRST; SELECT; WHEN (YRSTART EQ '01JAN96'D) SUBYEAR=1899; WHEN (YRSTART EQ '01JAN97'D) SUBYEAR=1899; WHEN (YRSTART EQ '01JAN98'D) SUBYEAR=1899; WHEN (YRSTART EQ '30DEC98'D) SUBYEAR=1898; WHEN (YRSTART EQ '01JAN99'D) SUBYEAR=1898; OTHERWISE DO; FILE LOG; PUT '>ERR> ' YRSTART DATE9. ' NOT IN DEFINED in $DWMY13.'; ABORT ABEND 510; END; END; YEAR=YEAR(YRSTART)-SUBYEAR; %MEND YEAR;Note:The processes for arriving at the dates and values to be subtracted are the same as discussed in the previous section.Specify start dates for your fiscal years where the previous example has coded the SAS DATE constants.You can determine the necessary dates and values by using "IF" or "IF-THEN-ELSE" logic. If, for instance, all the years that you defined have the same number that is subtracted from them to arrive at the fiscal year, then the only modification would be to the line containing 1900 as discussed in the #DWMY13 section.SAS SELECT logic enables you to specify each of the years individually, providing a form of documentation that, as System Administrator, you may find helpful.If only one year is required for subtracting a different amount than all others, you might find it simpler to code a statement that identifies that year and takes an action; it does something different for all other years.DEFAULT $DWMY13 MEMBER SHIPPED WITH CA MICS %LET MONTHDF=13; %MACRO DAY; %SETYRST; IF ENDDT-YRSTART GT 363 THEN DAY=ENDDT-YRSTART-335; ELSE DO; DAY=MOD(ENDDT-YRSTART+1,28); IF DAY EQ 0 THEN DAY=28; END; %MEND DAY; %MACRO WEEK; %SETYRST; IF WEEKDAY(YRSTART)-&WKSTART GE 0 THEN WEEK=INT((ENDDT-YRSTART+WEEKDAY(YRSTART) -&WKSTART)/7+1); ELSE WEEK=INT((ENDDT-YRSTART+WEEKDAY(YRSTART) -&WKSTART+7)/7+1); %MEND WEEK; %MACRO MONTH; %SETYRST; MONTH=INT((ENDDT-YRSTART+1)/28); IF MOD((ENDDT-YRSTART+1),28) NE 0 THEN MONTH=MONTH+1; IF MONTH GT 13 THEN MONTH=13; %MEND MONTH; %MACRO YEAR; %SETYRST; YEAR=YEAR(YRSTART)-1900; <== changes here!! %MEND YEAR; %MACRO SETYRST; ENDDT=DATEPART(ENDTS); YRSTART=INPUT(PUT(ENDDT,YRSTART.),5.); <== 5. to Date7.!! IF YRSTART EQ . THEN DO; VARX=PUT(ENDDT,DATE9.); CALL MICSLOG('BAS00473'); ABORT ABEND 510; END; %MEND SETYRST;
- Modify the MNTHFMT formatThe sharedprefix.MICS.SOURCE member MNTHFMT provides the full name for periods or months that are based on the period or month number. Modify MNTHFMT to use the names you decided upon earlier in this section. The MNTHFMT illustrated here shows periods P01 through P13.PROC FORMAT LIBRARY=MCOLIB.USERFMT2; VALUE MNTHFMT 1 = 'P01' 2 = 'P02' 3 = 'P03' 4 = 'P04' 5 = 'P05' 6 = 'P06' 7 = 'P07' 8 = 'P08' 9 = 'P09' 10 = 'P10' 11 = 'P11' 12 = 'P12' 13 = 'P13';Note:These changes become effective when you run BASPGEN.
- Save your modificationsEnsure that you have backed up your databases and libraries before saving both the #memname and $memname members and the MNTHFMT member in the sharedprefix.MICS.SOURCE library.
- Make these changes effectiveFor each unit, submit the job in prefix.MICS.CNTL(BASPGEN). Ensure that there are no error messages in MICSLOG and that the job completes with a condition code of zero.
- (Conditional) Generate and load the yrstart formatIf your site needs more than 8 years of data, or your 'year start' value requires 2 dates that start in the same calendar year (01JAN98 and 28DEC98), you can code a PROC FORMAT table to associate the year start date with a date range.Modify the YRSTART macro to accept a DATE7. Code the format of the year start date for convenience in the format statements.%MACRO SETYRST; ENDDT=DATEPART(ENDTS); YRSTART=INPUT(PUT(ENDDT,YRSTART.),5.); <== 5. to Date7.!! IF YRSTART EQ . THEN DO; VARX=PUT(ENDDT,DATE9.); CALL MICSLOG('BAS00473'); ABORT ABEND 510; END; %MEND SETYRST;Finally, generate a YRSTART format to use in theMICSdate processing routines that you have modified. The format must take the following form:PROC FORMAT LIBRARY=MCOLIB.USERFMT1 PRINT; VALUE YRSTART OTHER='.' '01JAN96'D - '31DEC96'D = '01JAN96' ... '01JAN98'D - '31DEC98'D = '01JAN98';For each year that you want to specify toMICS, code a SAS statement like the previous one, substituting your first, and last dates where the date constants are in the example. The form is:'first date'D - 'last date'D = 'year start date'Do NOT specify the Date (D) constant modifier for the year start date!Note:The YRSTART format is recreated and written to the prefix.MICS.MUOLIB MICSFMTS format catalog every time BASPGEN is executed. In order to use your calendar definitions, we recommend that you write your YRSTART format to the MCOLIB.USERFMT1 library, as shown previously. This way, because of the catalog search orderMICSspecifies at initialization, your format will always be found first, and consequently, used.The YRSTART format must be a permanent SAS format. User-defined Informats and Formats provide instructions for creating permanent user-defined formats.Successfully generating and saving this format concludes the implementing process for 13-month calendars.