07-15-2014 05:46 AM
Hi I am Sorry for small correction in data.
looking the duplicate data within the same dataset by the different fields
input name $5.+1 phone $5.;
Am looking duplicate phone numbers by Name.(Same name having different Phone numbers)
I think we can use Soundex function to get exact duplicate values by proc sql;
plz any one help me with syntax.
Would Appreciate in Advance.
07-15-2014 06:01 AM
attrib Name Phone format=$200.;
name="AAA"; phone="12345"; output;
name="AAA"; phone="67890"; output;
name="BBB"; phone="fssfs"; output;
create table WANT as
group by NAME
07-15-2014 06:42 AM
Thnank you for your valuable information
I Think we can use SOUNDEX Function to get exact Duplicates values.
create table dups as select distinct a.*, b.*
from have as a,have as b
where soundex(a.name) eq soundex(b.name) and a.phone ne b.phone
order by a.name
07-15-2014 07:06 AM
less elegant, but if you don´t care to sort and merge:
Proc Sort Data=have;
Proc Freq Data=Have NoPrint;
Tables name / Out=Have_F (Keep=Count name);
Data Want (Where=(Count ge 2));
Merge Have (in=inH) Have_F (in=inF);
07-15-2014 09:50 AM
Still not full sure what you try to get.
data have; input name $5.+1 phone $5.; cards; AAAAA 12345 AAAAC 12345 AAAAA 09876 BBBBB 12345 CCCCC 99999 DDDDE 88888 DDDDD 88888 DDDDD 55555 EEEEE 44444 FFFFF 11111 ; RUN; proc sql; select * from have group by name having count(distinct phone) ge 2; quit;