Hi all,
I have a rather large dataset with two fields, phone1 and phone2. These are text based fields with up to 10 digit phone numbers, no special characters.
I'm looking for some ideas on how to set a flag field based on what could be a valid number, which is to say if the field is '0000000000', '4488888888', '999999', etc... I'd like to set a flag to mark it as potential unviable.
I've taken a stab at both proc sql (case statements) and data step (if/else) but I feel like I'm being inefficiant with my approach.
Any ideas?
Thanks in advance.
Hi @Ody,
I think, before you start coding, you should write down specifications. Once you have a (preliminary) list of criteria (like "less than 5 digits", "more than 5 repetitions of the same digit", etc.), it will be fairly straightforward to program the corresponding IF conditions in a data step (maybe using the PRX functions). And many people in the forum will be able to support you.
PROC SQL will probably not come into play, unless you include criteria involving more than one observation at a time (like "more than 3 records have the same phone numbers").
Wow, thanks for the link and feedback. Not sure why I didn't think of Googling that myself...
EDIT: The solution in the linked document worked beautifully. I made some modifications based on what I'm looking for but that gave me a great start. Thanks!!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.