• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • Synchronization
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Numeric Values
      • String Values
      • 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
      • StringWriter Object
      • SystemApp Object
      • ValueSet Object
        • ValueSet Statement
        • ValueSet.add Function
        • ValueSet.remove Function
        • ValueSet.removeDuplicates Function
        • ValueSet.clear Function
        • ValueSet.length Function
        • ValueSet.randomize Function
        • ValueSet.show Function
        • ValueSet.sort Function
      • 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
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

ValueSet.removeDuplicates Function

Format
i = valueset_name.removeDuplicates(ʃ by code ‖ label ʅ);
Description
The ValueSet.removeDuplicates function removes duplicate values from a ValueSet object, leaving the first entry of a duplicate in the dynamic value set. Because a value set entry has both a code and a label, a duplicate is considered as follows, based on the argument to the function:
ArgumentDuplicate
—A duplicate is when both the code and label match.
by codeA duplicate is when the code matches, even if the label differs.
by labelA duplicate is when the label matches, even if the code differs.
When using a numeric value set with ranges (i.e., both from and to codes are defined), a duplicate code is considered one where both the from and to values are identical. For example, the following codes are considered unique: 0, 0 - 4, 0 - 9.
Return Value
The function returns the number of duplicates removed from the value set. If the value set is read-only, the function returns default.
Example
PROC REPORT_DISTRICT

preproc

   
// for this dynamic value set, show only districts in the
    // selected province where data has been collected
    ValueSet districts_vs;

   
forcase PHC_DICT where PROVINCE = REPORT_PROVINCE do
        districts_vs.
add(DISTRICT_VS1, DISTRICT);
   
endfor;

   
// remove duplicates
    districts_vs.removeDuplicates();

   
setvalueset(REPORT_DISTRICT, districts_vs);
See also: ValueSet Object, ValueSet.remove Function