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 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 755 views
  • 1 like
  • 2 in conversation