BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear,

 

I have a variable with date contains UN and UNK string. How to read it. Please help

 

  id                  date1                                 date2

  1                   06/01/2012

  2                     .                                      UN-UNK-2014

 3                                                             UN-Sep-2014

 

 

output needed;

id                                chadate

1                                 2012-06-01  

2                                 2014

3                                 2010-09                                                           

2 REPLIES 2
ballardw
Super User

Are you attempting to get an actual SAS date valued variable or a character variable?

If you have SAS date values then the format applied to the variable would make all of the values display in the same form an incomplete values such as 2014 would internally be 1/1/2014 and 2010-9 would be 9/1/2010.

 

If you are going to deal with calculations such as intervals between dates or create graphs with dates you likely want SAS date values but the default appearances are not going to be as you show.

knveraraju91
Barite | Level 11

Thanks for the suggestion . I need the Chardatevalue and output as mentioned. Please help.

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!

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
  • 2 replies
  • 1029 views
  • 0 likes
  • 2 in conversation