Help using Base SAS procedures

Converting text to date format

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Converting text to date format


I have a text variable called transaction date  which has values like 01-APR-14. I want to convert this variable to a date variable in the format ddmmyy.

I have used the code

date=input(substr(strip(transaction_date),1,9),MMDDYY10.)

This doesn't seem to work. Can anyone suggest how to do this.


Accepted Solutions
Solution
‎05-17-2014 02:49 PM
Super User
Posts: 19,770

Re: Converting text to date format

Assuming transaction_date is a character the following is what you want:

date=input(strip(transaction_date), date9.);

format date mmddyy10.;

View solution in original post


All Replies
Solution
‎05-17-2014 02:49 PM
Super User
Posts: 19,770

Re: Converting text to date format

Assuming transaction_date is a character the following is what you want:

date=input(strip(transaction_date), date9.);

format date mmddyy10.;

🔒 This topic is solved and locked.

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

Discussion stats
  • 1 reply
  • 273 views
  • 0 likes
  • 2 in conversation