Hi all,
Is there a way to identify phone numbers with all the same digits in one phone number? For example, the phone numbers like 1111111111, 5555555555, 9999999999.
Thanks a lot!
Lizzy
Hi @lizzy28,
Alternatively, you can use character functions. For example, the criterion
compress(t,first(t))=' '
should work for non-empty digit strings t (without hyphens, parentheses, leading blanks, etc.).
Step 1: turn the phone number into a sequence of ten numeric (not character) single digit values.
Step 2: determine the min and max of these 10 single digit values, if the min=max then you have all the same digits
Example:
data have;
phone_number='1111111111';
array digit digit1-digit10;
do i=1 to 10;
digit(i)=input(substr(phone_number,i,1),1.);
end;
delta=max(of digit(*))-min(of digit(*));
drop i;
run;
Hi @lizzy28,
Alternatively, you can use character functions. For example, the criterion
compress(t,first(t))=' '
should work for non-empty digit strings t (without hyphens, parentheses, leading blanks, etc.).
If it's a 10 digit number then
if mod(phone_number,1111111111)=0 then flag=1;
else flag=0;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: