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>
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.