• <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
      • String Functions
      • Multiple Occurrence Functions
        • Average Function
        • Count Function
        • CurOcc Function
        • Delete Function
        • GetOccLabel Function
        • Insert Function
        • Max Function
        • MaxOcc Function
        • Min Function
        • NOccurs Function
        • Seek Function
        • SeekMax Function
        • SeekMin Function
        • SetOccLabel Function
        • SOccurs Function
        • Sort Function
        • Sum Function
        • Swap Function
        • TotOcc Function
      • 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>

Max Function

Format
d = max(multiple_item ʃwhere conditionʅ);
Description
The max function returns the maximum value of an item that occurs multiple times.
During data entry, the result of the maximum calculation depends on where the statement is located. If the max function is executed prior to the form or roster containing the item, it returns default. If it is executed within the form or roster containing the item, it returns the maximum value up to the current occurrence number. If it is executed after the form or roster containing the item, it returns the maximum value for all occurrences of the item.
During batch editing, if the values of the items are not changed, the result of the maximum calculation is the same, no matter where the function is located. The function will return the maximum value for all occurrences of the item.
If a where condition is included, the function returns the maximum value of all occurrences for which the condition is true.
If any occurrence of the item is a special value (default, missing, refused, or notappl), the occurrence will not be included in the calculation. If all item occurrences are special values, then default will be returned.
Return value
The function returns a decimal value.
Examples
MAX_INCOME = max(INCOME);
MAX_FEMALE_INCOME = 
max(INCOME where SEX = 2);
See also: Min Function