DATA Step, Macro, Functions and more

converting a date string to a sas date.

Accepted Solution Solved
Reply
Super Contributor
Posts: 259
Accepted Solution

converting a date string to a sas date.

[ Edited ]

I'm trying to convert a string date into a sas date but the date is in the form

 

2012/9/1 i.e. no leading zeros for the month or day

 

For another field which has date in the form 01/09/2012 I am using this:

 

sasdate = input(compress(scan(scrape_time)),ddmmyy10.)

 

which works.

 

Any ideas? My version of SAS is 9.3

 

Thank you 


Accepted Solutions
Solution
‎09-16-2016 06:38 AM
Valued Guide
Posts: 2,177

Re: converting a date string to a sas date.

Try
Input( yourdatestring, yymmdd10. )

View solution in original post


All Replies
Solution
‎09-16-2016 06:38 AM
Valued Guide
Posts: 2,177

Re: converting a date string to a sas date.

Try
Input( yourdatestring, yymmdd10. )
☑ This topic is solved.

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

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