• <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
        • Numeric Statement
        • String Statement
        • Alpha Statement
        • config Variable Modifier
        • ensure Variable Modifier
        • persistent Variable Modifier
        • Visual Values for Numeric Fields
        • Relation Statement
        • Function Named Arguments
        • Function Statement
        • Optional Function Parameters
        • Passing Function Arguments by Reference
        • Additional Examples of User-Defined Functions
        • Dot Notation, Logic Objects, and Namespaces
      • 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
      • 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>

Numeric Statement

Format
numeric variable1ʃ, variable2, ..., variableNʅ;
Description
The numeric statement declares temporary numeric variables used in applications. They will not be saved to a data file defined by a dictionary. A numeric variable is an integer or decimal number significant to 15 digits. Upon declaration a numeric variable's initial value will be 0.
Local variables, with a limited scope, can also be declared in functions and PROCs. The variable will only exist and be accessible from within the function or PROC where it is declared. (In the case of a PROC, it is available in all events within that PROC after its declaration. For example, a numeric declared in the preproc will still be accessible in the postproc.)
While a locally-declared variable cannot have the same name as a globally-declared variable, the same local variable name can be reused in other PROCS associated with individual variables.
Variable Modifiers
The following variable modifiers apply to numeric variables:
  • config: to initialize the variable from configuration settings.
  • ensure: to create a variable only when it has not already been declared in a dictionary or logic.
  • persistent: to persist the variable's value from one run of an application to another.
Example
PROC GLOBAL

numeric NumOfKids, NumOfMoms;

PROC CHILDREN
   
numeric x;

    NumOfKids = NumOfKids + 
1;
    x = NumOfKids + NumOfAdults;

PROC BIOLOGICAL_MOTHER
   
numeric x;  // redeclaring a variable named "x", which is okay

    NumOfMoms = NumOfMoms + 
1;
    x = NumOfMoms + NumOfDads;
See also: Array Statement, String Statement, ensure Variable Modifier