Desktop productivity for business analysts and programmers

SAS Code

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

SAS Code

i have a dataset that looks like

 

customer_id      cellphone

deeee                 0897777

deesss                65788

reeesss              7866

 

(not real values)

 

I want to check which of the customer_id has the same cellphone value

 

 

 


Accepted Solutions
Solution
‎06-14-2016 05:35 AM
Super User
Posts: 5,387

Re: SAS Code

or

proc sql;
select *
from have
group by cellphone
having count(*) > 1
;
quit;
Data never sleeps

View solution in original post


All Replies
Super User
Posts: 7,444

Re: SAS Code

From the hip:

proc sql;
select
  a.customer_id as cust1,
  b.customer_id as cust2,
  a.cellphone as cell
from have as a, have as b
where a.cellphone = b.cellphone and a.customer_id ne b.customer_id
;
quit;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎06-14-2016 05:35 AM
Super User
Posts: 5,387

Re: SAS Code

or

proc sql;
select *
from have
group by cellphone
having count(*) > 1
;
quit;
Data never sleeps
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 248 views
  • 0 likes
  • 3 in conversation