Hi,
This is a really simple problem, but I can't seem to find a solution.
My date variable is in an informat and format of DATETIME20. I want it to be in a MMDDYY10. format. How do I change my date variable from a DATETIME20. to MMDDYY10. format? I want my date variable that looks like this "01FEB2016:00:00:00" to look like this "02/01/2016."
Hi,
You want the datepart() function:
data want; thedt="01FEB2016:00:00:00"dt; thedt=datepart(thedt); format thedt mmddyy10.; run;
Hi,
You want the datepart() function:
data want; thedt="01FEB2016:00:00:00"dt; thedt=datepart(thedt); format thedt mmddyy10.; run;
Awesome. That works perfectly!
Thank you, RW9.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.