BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vaidas
Fluorite | Level 6

The data already exist on the table. It is required to verify of Date of Birth is in correct format. Currently Date of Birth field is in $CHAR10. format. It is not required to fix wrong format cases just identify them. The required format is dd/mm/yyyy. How to retrieve output were below mentioned cases doesn't meet format = dd/mm/yyyy. Thanks in advance.

 

Sample of data:

1963/12/31

31/12/2007
31/12/2008
31/12/2009
31/12/2010
31/12/2011
31/12/2012
31/12/2013
31/12/2014
31/12/2015
31/12/2016
31/12/2018
?

1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @vaidas 

 

I suggest that you use the input function, so that SAS try to convert the character value to SAS date value:

data want;
	set have;
	if input(date, ddmmyy10.) ne . then valid_date = 'Y';
	else valid_date = 'N';
run;

Capture d’écran 2020-02-26 à 10.56.57.png 

View solution in original post

1 REPLY 1
ed_sas_member
Meteorite | Level 14

Hi @vaidas 

 

I suggest that you use the input function, so that SAS try to convert the character value to SAS date value:

data want;
	set have;
	if input(date, ddmmyy10.) ne . then valid_date = 'Y';
	else valid_date = 'N';
run;

Capture d’écran 2020-02-26 à 10.56.57.png 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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
  • 1 reply
  • 358 views
  • 1 like
  • 2 in conversation