DATA Step, Macro, Functions and more

SAS dates from Character Strings

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

SAS dates from Character Strings


I have a character string '03-jul-95' that has a format of $255. and an informat of $255.   I want to convert this to a SAS date.   I know how to substring the individual components but I don't know how to convert 'jul' to month number to use the MDY function.  I would appreciate any assistance I can get.   Thanks,


Accepted Solutions
Solution
‎03-24-2015 01:41 PM
Super User
Super User
Posts: 6,502

Re: SAS dates from Character Strings

Use the INPUT function so that you can use an INFORMAT to convert the value for you.

mydate = input(mystring,date11.);

format mydate date9. ;

View solution in original post


All Replies
Solution
‎03-24-2015 01:41 PM
Super User
Super User
Posts: 6,502

Re: SAS dates from Character Strings

Use the INPUT function so that you can use an INFORMAT to convert the value for you.

mydate = input(mystring,date11.);

format mydate date9. ;

New Contributor
Posts: 3

Re: SAS dates from Character Strings

Thank you so much for the quick reply.  I do appreciate it

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 230 views
  • 0 likes
  • 2 in conversation