• <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
      • File Object
      • Freq Object
      • HashMap Object
        • HashMap Statement
        • HashMap.GetKeys Function
        • HashMap.Contains Function
        • HashMap.Length Function
        • HashMap.Remove Function
        • HashMap.Clear Function
      • 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
    • 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>

HashMap.GetKeys Function

Format
i = hashmap_name.getKeys(list_name 『, key_value1, ..., key_valueN』);
Description
The hashmap.getKeys function fills a list with the keys at a specific location in the hashmap. Each key_value argument must be a numeric or string expression matching the type specified when declaring the hashmap. If no arguments are provided, the first-dimension keys are returned; if one argument is provided, the second-dimension keys are returned; and so on.
The argument list_name is a numeric or string list whose contents will be cleared and then filled with the hashmap's keys. The type of the list must correspond to the type of keys at the specified location. If the dimension type is numeric, then the list must be a numeric list. If the dimension type is string or all, then the list must be a string list. In the case of all, any numeric values added as keys to the hashmap will be converted to strings before being inserted in the string list.
Return Value
The function returns the number of keys added to the list.
Example
PROC GLOBAL

hashmap
invalidValuesByPerson default(0);

PROC CENSUS_LEVEL

   
list string person_list;

    invalidValuesByPerson.getKeys(person_list);

   
do numeric counter = 1 while counter <= person_list.length()
       
errmsg("%s had %d invalid values", strip(person_list(counter)),
                                           invalidValuesByPerson(person_list(counter)));
   
enddo;

    invalidValuesByPerson.clear();

PROC SEX

   
if not invalueset(SEX) then
        inc
(invalidValuesByPerson(PERSON_NAME));
   
endif;

PROC AGE

   
if not invalueset(AGE) then
        inc
(invalidValuesByPerson(PERSON_NAME));
   
endif;
See also: HashMap Object, HashMap.Contains Function, HashMap.Length Function