• <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>

Alpha Statement

Feature Upgrade: Since CSPro 6.0, you can now use variable-length strings. You are encouraged to use the string declaration instead of fixed-width alpha variables whenever possible.
Format
alpha ʃ(length)ʅ var1ʃ, var2, ..., varNʅ;
Description
The alpha statement is used to define alphanumeric variables within an application. The length is the number of characters in the variable. The length applies to all variables declared in the same alpha statement. If no length is given, 16 is assigned. The maximum string length that can be declared is 8,192.
If you attempt to assign a string that is longer than the variable's size, the string will be truncated from the right. Conversely, it you assign a string that is shorter than the variable's size, the trailing character positions will be blank-filled.
Variable Modifiers
The following variable modifiers apply to alphanumeric variables:
  • persistent: to persist the variable's value from one run of an application to another.
Example 1
alpha(10) x, y;

x = 
"hi mom";           // x will equal "hi mom    "
                        //               1234567890

x = 
"good night, mom";  // x will equal "good night"
                        //               1234567890
Example 2
PROC GLOBAL

alpha (3) reply;
alpha flag;

PROC Q5

if Q5 = 1 then
    reply = 
"Yes";
    flag = 
"Y";             // flag will equal "Y               "
                            //                  1234567890123456
else
    reply = 
"Not Reported"; // reply will equal "Not"
                            //                   123
endif;
See also: String Statement, Array Statement, Numeric Statement