• <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 Values
      • String Values
      • 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
        • List Statement
        • List.add Function
        • List.insert Function
        • List.seek Function
        • List.remove Function
        • List.removeDuplicates Function
        • List.removeIn Function
        • List.clear Function
        • List.length Function
        • List.show Function
        • List.sort Function
        • JSON Representation
        • JavaScript Representation
      • Map Object
      • Path
      • Pff Object
      • StringWriter 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
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

List Statement

Format
List ʃlist_typeʅ list_name;
Description
The List statement creates a List with the name list_name. The List name must be unique and must contain only letters, numbers, or the underscore character. The name must begin with a letter. You can declare List objects globally in PROC GLOBAL or locally in functions or procedures.
List objects can be numeric or string. By default a List is numeric, but the type can be modified by specifying the list_type.
The initial elements of a List can be set on definition by listing each value, separated by a comma. A List can also be initialized to the values of another List.
Variable Modifiers
The following variable modifiers apply to List objects:
  • persistent: to persist the variable's value from one run of an application to another.
Example
// numeric List objects
List DaysPerMonthTypical = 31, 28, 31, 30, 31, 30,
                           
31, 31, 30, 31, 30, 31;

List numeric DaysPerMonthLeapYears = DaysPerMonthTypical;
DaysPerMonthLeapYears(
2) = 29;

// string List
List string MonthNames = "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                         
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec";
See also: List Object, Array Object, HashMap Object, ValueSet Object