• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
        • ABS Function
        • CMCode Function
        • CountNonSpecial Function
        • Exp Function
        • High Function
        • Inc Function
        • Int Function
        • Log Function
        • Low Function
        • Random Function
        • RandomIn Function
        • Round Function
        • Seed Function
        • Sqrt Function
        • Set Behavior SpecialValues Statement
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

CMCode Function

Format
i = cmcode(month, year);
Description
The cmcode function returns the century month code (CMC) of the given date using the month and year numeric expressions. The CMC is the number of months since January 1900. (The CMC for January 1900 is 1.) It is calculated by multiplying the number of years between the argument year and 1900 by twelve, then adding the value of argument month.
The function returns the value 9999 if the month is less than one or greater than 12, or if either the month or year are equal to a special value. The function accepts either 2- or 4-digit years. If a 2-digit year is used, the function assumes that the year is in the 20th century (i.e., 19xx). Four-digit years can be used for years in the 20th or 21st century.
Return Value
The function returns the CMC of the date.
Example 1
XMONTH = 6;
XYEAR = 
82;
DATE = 
cmcode(XMONTH, XYEAR);
The value of DATE for the given arguments (June 1982) would be ( 82 * 12 ) + 6 = 990.
Example 2
XMONTH = 2;
XYEAR = 
2000;
DATE = 
cmcode(XMONTH, XYEAR);
The value of DATE in this example would be ( ( 2000 - 1900 ) * 12 ) + 2, or 1202.
See also: DateAdd Function, DateDiff Function, DateValid Function, SysDate Function