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

List.removeDuplicates Function

Format
i = list_name.removeDuplicates();
Description
The List.removeDuplicates function removes duplicate values from a List, leaving the first instance of any duplicate in the List.
Return Value
The function returns the number of duplicates removed from the List. If the List is read-only, the function returns default.
Example
List string women_names;

for POPULATION_RECORD where HH_SEX = 2 and HH_AGE in 12:95 do
    women_names.
add(HH_NAME);
enddo;

women_names.
show("Women in Household");
// possible results: Maria, Maria, Linda, Maria, Pamela, Linda, Maria

numeric duplicates_removed = women_names.removeDuplicates();
women_names.
show(maketext("Women in Household (%d duplicates removed)", duplicates_removed));
// possible results (4 duplicates removed): Maria, Linda, Pamela
See also: List Object, List.clear Function, List.remove Function, List.removeIn Function