BookmarkSubscribeRSS Feed
myboys2
Fluorite | Level 6

 

hi

 

I have a file that has dob dates coming in with  char formats as 12/31/1977 and 1914-07-15. Same field different formats.  How do i make them in the same format coming in as char in the end? 

 

Thank you

3 REPLIES 3
Reeza
Super User

You shouldn't store as char because you can't do calculations on a char date variables, but try anydtdte as your informat. If you really want it as a char you can convert it. 

LinusH
Tourmaline | Level 20
This would be my steps of priority :
1. Go to your data supplier and require the the files should have a consistent format.
2. Test the input variable with the more common informat of the two. If no success use the other informat.
3. ANYDTDTE.
Data never sleeps
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I am with @LinusH here, the problem lies with your data supplier.  You will of course have a data import agreement setup which defines the structure, content of the data yes?  If not, then whatever you code may need to change next time you get data, I mean wht if the vendor decides to drop that field, or add a field, or change them all to DDMONYYYY?  The control and specification is all in the documentation, programming is more or less irrelevant.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1320 views
  • 2 likes
  • 4 in conversation