DATA Step, Macro, Functions and more

How to read date values in different with unknown month and date

Reply
Super Contributor
Posts: 272

How to read date values in different with unknown month and date

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                                                           

Super User
Posts: 11,343

Re: How to read date values in different with unknown month and date

Posted in reply to knveraraju91

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.

Super Contributor
Posts: 272

Re: How to read date values in different with unknown month and date

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

Ask a Question
Discussion stats
  • 2 replies
  • 205 views
  • 0 likes
  • 2 in conversation