• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • 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
        • Clear Function
        • Close Function
        • CountCases Function
        • CurrentKey Function
        • DelCase Function
        • DirCreate Function
        • DirDelete Function
        • DirExist Function
        • DirList Function
        • FileConcat Function
        • FileCopy Function
        • FileCreate Function
        • FileDelete Function
        • FileEmpty Function
        • FileExist Function
        • FileName Function
        • FileRead Function
        • FileRename Function
        • FileSize Function
        • FileTime Function
        • FileWrite Function
        • Find Function
        • Key Function
        • KeyList Function
        • LoadCase Function
        • Locate Function
        • NMembers Function
        • Open Function
        • Retrieve Function
        • Set Access Statement
        • SetFile Function
        • Set First Statement
        • Set Last Statement
        • Write Function
        • WriteCase Function
      • Synchronization Functions
      • Export Attributes
    • 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>

Set Access Statement

Format
set access(dictionary_name, type.valueʃ, type.value, ...ʅ);
Description
The set access statement is used to control the way that CSPro iterates through a data file. By default, CSPro processes all non-deleted cases in file order for the main input file of a batch application or in ascending key order (e.g., A -> B -> C) for all other files. With this statement, you can change the default behavior to process cases in a different order or to control what cases are processed.
The dictionary_name refers to either an external dictionary or the main input file of a batch application. If the dictionary access parameters are modified while in the middle of iterating through the data file, the next case loaded will be based on the location of the currently loaded case. For example, if you are running a batch application on cases 1 to 5, and then after processing case 3 you change the order to descending, the next cases loaded will be 2 and 1.
Dictionary Access Parameters
TypeValuesDescription
OrderTypeIndexedIterate based on the alphabetical value of the case's key (default for external dictionaries)
SequentialIterate based on the case's position in the file (default for batch inputs)
 
OrderAscendingIterate from low to high value (key or file position) (default)
DescendingIterate from high to low value (key or file position)
 
CaseStatusAllIterate through all cases, including deleted cases
NotDeletedIterate through all non-deleted cases (default)
PartialIterate through non-deleted partially saved cases
DuplicateIterate through non-deleted cases where there are at least two cases with the same key in the file
Temporarily Modifying the Dictionary Access Parameters
Using set access, the dictionary access parameters are modified until the next call to set access. However, it is also possible to temporarily change the dictionary access parameters when using several functions or statements. By specifying the parameters in parentheses after the dictionary name in uses of countcases, forcase, keylist, and selcase, the access to the dictionary will only be changed for the duration of that routine.
An additional parameter that can be used with these functions is startswith, functionality that allows for partial iteration of only cases with keys that start with the specified key prefix.
Example 1
PROC CENSUS_FF

preproc

   
// process the batch input in order from the last province to the first
    set access(CENSUS_DICT, OrderType.Indexed, Order.Descending);
Example 2
forcase CENSUS_DICT(CaseStatus.Partial) do
    interview_vs.add(
"Continue interview: " + getcaselabel(CENSUS_DICT), key(CENSUS_DICT));
endfor;
Example 3
// only process assignments in the area where the supervisor is working
forcase GEOCODES_DICT(startswith, strip(MENU_GEOCODE_SELECTION)) do
   
// ...
endfor;
See also: Set First Statement, Set Last Statement, Locate Function