data have; length borr_ph $10 co_borr_ph $10 alt_ph $10 ; input borr_ph -- alt_ph; datalines; 8042234314 0000000000 3334444444 0000000000 1111111111 9999999999 2132245566 1121111111 2321111111 1111114444 0000000000 1111111111 1112223333 8042342256 0000000000 ; run;
data want; set have; if substr(borr_ph,1,4) in('0000','1111','2222','3333','4444','9999') then no_borr_ph='Y'; if substr(co_borr_ph,1,4) in('0000','1111','2222','3333','4444','9999') then no_co_borr_ph='Y'; if substr(alt_ph,1,4) in('0000','1111','2222','3333','4444','9999') then no_alt_ph='Y'; if no_borr_ph ='Y' and no_co_borr_ph='Y' and no_alt_ph = 'Y' then No_Phone = 'Y'; run;
I used a substr analysis to try and identify phantom phone numbers (numbers that
obviously are bogus) I successfully flagged those with the phantom or non-phone number.
My actual code has about 20 different phone numbers. Is there a way to apply some type
of array so I do not have to repeat the entire sequence of code as seen here.
Note the reason I am using a sequence of first four numbers is because it is unlikely
that a phone number begin with the same 4 numbers consecutive
... View more