How do i use perl regular expression to pick up -00- in the 4th and 5th position of an ssn number?
Am trying to clean a data set with fake ssn like this one 000-00-0000, most of the fake one have 00 in the 4 and 5th position or the 0000 as the last four digits.
'/(\d{3})-(00)-(\d{4})/'
i tried the code above but didn't work... thanks.
Am trying to clean a data set with fake ssn like this one 000-00-0000, most of the fake one have 00 in the 4 and 5th position or the 0000 as the last four digits.
One thing that you may want to check is if the value is actually a character value. SAS has a SSN format that displays numbers intended to be SSN with dashes and may make you think it is character when actually numeric. The regular expressions tend not work as expected on actual numeric values.
If character I might look to SCAN as well
if scan(variable,2,'-')='00' or scan(variable,3,'-')='0000' then <whatever when found>
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.