I have a following date i have to convert it to numeric and iso8601 format
UN-UNK-1975
UN-OCT-1986
18-OCT
Expected o/p:
1975
10-1986
.
Thanks
1975 and 10-1986 are not valid dates in any format - a date requires a day, month and a year. If you only know the year 1975 what would you default your date to? 01-01-1975? Similarly does 10-1986 become 01-10-1986?
You need more examples in order to define the algorithm.
I suggest to locate in your input:
1) A 4 digits sub-string assumed as a year
2) A 3 characters sub-string to be checked against a list or by a format
containing all months (JAN FEB MAR ...)
3) Is there in your input full name month? (JANUARY FEBRUARY ...) or
mixed case like January February ... ? or month given in digits ?
If answer is positive you need more code in the algorithm.
Your expected output does not conform to ISO 8601. Your question makes no sense.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.