I've been fighting with this one and it's time to just ask for help.
I tried other solutions from the community forums but they didn't work
So let's call the variable RPT_DATE. The data I received is formatted like: 3/11/2020 9:01:54 AM
When I import this it appears as 11MAR20:09:01:54 Format as DATETIME. Informat ANYDTDTM40.
What I need to do is convert this so that it reads as 03/11/2020.
I'm sorry, I am sure this is simple but I have struck out at this point.
Use the DATEPART function. In a DATA step:
date_only=datepart(rpt_date);
format date_only mmddyy.;
What I need to do is convert this so that it reads as 03/11/2020.
Adding, this is often a poor choice to format dates, as the above date can be interpreted as March 11 or November 3. So I recommend you avoid using this format if at all possible.
Use the DATEPART function. In a DATA step:
date_only=datepart(rpt_date);
format date_only mmddyy.;
What I need to do is convert this so that it reads as 03/11/2020.
Adding, this is often a poor choice to format dates, as the above date can be interpreted as March 11 or November 3. So I recommend you avoid using this format if at all possible.
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.