• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
      • Introduction to CSPro Language
      • Data Requirements
      • CSPro Program Structure
      • Programming Standards
      • Code Folding
      • Debugging CSPro Applications
      • Declaration Section
      • Procedural Sections
      • Logic
      • Language Elements
        • Delimiters
        • Comments
        • Logic Preprocessor
        • Variables and Constants
        • Expressions
        • Operators
          • Operators
          • In Operator
          • Has Operator
          • If and Only If Operator
          • Operator Precedence
          • And/Or Truth Table
        • Files
        • Miscellaneous
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Appendix
  • <Helps for CSEntry>
  • <Helps for CSBatch>
  • <Helps for CSTab>
  • <Helps for DataViewer>
  • <Helps for TextView>
  • <Helps for TblView>
  • <Helps for TRSWin>
  • <Helps for CSDeploy>
  • <Helps for CSPack>
  • <Helps for CSFreq>
  • <Helps for CSSort>
  • <Helps for CSExport>
  • <Helps for CSReFmt>
  • <Helps for CSDiff>
  • <Helps for CSConcat>
  • <Helps for TRSSetup>
  • <Helps for ParadataViewer>
  • <Helps for ParadataConcat>
  • <Helps for CSIndex>
  • <Helps for Excel2CSPro>
  • <Helps for CSWeb>

In Operator

Description
The in operator is used in logical expressions to test whether an item or variable is within a set of values or ranges. The item or variable can be a number or a string. A range of values is separated by a colon, for example 1:5. Elements of a list of values or ranges are separated by commas, for example 1,3:5,7. You can also use special to mean all special values (as in the special function). The in operator can also be used to test whether a value is in several CSPro objects:
  • A list can be used to determine if the value is located in the list's values (as in the list.seek function).
  • A value set can also be used to test whether a value is in the value set's codes (as in the invalueset function).
Example 1
if RELATIONSHIP in 1:5 then
// is the same as...
if RELATIONSHIP >= 1 and RELATIONSHIP <= 5 then
Example 2
if WORK in 1, 3, 5 then
// is the same as...
if WORK = 1 or WORK = 3 or WORK = 5 then
Example 3
if X in 1:4, missing, refused then
// is the same as...
if ( X >= 1 and X <= 4 ) or X = missing or X = refused then
Example 4
if NAME in "A":"MZZ" then
// is the same as...
if NAME >= "A" and NAME <= "MZZ" then
Example 5
if AGE in AGE_TEENAGE_VS, special then
// is the same as...
if invalueset(AGE, AGE_TEENAGE_VS) or special(AGE) then
See also: Has Operator