BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I'm very new to SAS
Please excuse my ignorance with some of my questions.
I have a social security column which is manually entered by some outside users.
Is there a way for me to check this column based on this format: XXX-XX-XXXX
I want to find the columns that don't match this format if possible.

Thank You
Jerry
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
One technique in a SAS DATA step is to use TRANSLATE such as:

DATA _NULL_;
SSN = '222-22-2222';
IF TRANSLATE(SSN,'%%%%%%%%%%','0123456789') NE '%%%-%%-%%%%' THEN PUTLOG '>ERROR> INVALID VARIABLE: ' SSN= ;
RUN;

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Scott,
Thank you again for your help. That is what I was looking for. All I have to is change it around a bit for populate the column with null if the format doesn't match.

Thank You
Jerry
deleted_user
Not applicable
Regular expressions would do this too.

A right riveting read...

http://www2.sas.com/proceedings/sugi29/265-29.pdf

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 608 views
  • 0 likes
  • 2 in conversation