Page 1 of 1

Remove Duplicate valuesets

Posted: July 27th, 2024, 2:58 pm
by Habtamu
Dear Cspro team
I need some assistance how remove duplicate value sets. I have external dictionary which is used to select household from it.The same household may be available in that external dictionary, but I used it for lookup to another applications for household selections, but appears more than one's times or doubled but I want only one.

I used the below functions, it works but the valuesets are Moren thanm Please help

Thank you

PROC TPMHHID
preproc
ValueSet Tempohh_vs;

forcase CROPSELECTED_DICT where SENUMID = TPENUMID do

//
Tempohh_vs.add(SHHNAME, SHH_ID);

enddo;

Tempohh_vs.sort();


setvalueset($, Tempohh_vs);

Re: Remove Duplicate valuesets

Posted: July 29th, 2024, 9:28 am
by Gregory Martin
When you are building your value set, you can check if a code has already been added and then only add it if that has not happened:
if Tempohh_vs.codes.seek(SHH_ID) = 0 then
   
Tempohh_vs.add(SHHNAME, SHH_ID);
endif;

Re: Remove Duplicate valuesets

Posted: August 19th, 2024, 12:40 pm
by Habtamu
Thank you, Gregory, for your help the code you sent is solved my issues on duplicate value sets.