Can this be done in the advanced expression calculation?
Example data to convert from char to SAS date:
02/12/2016 to 12FEB2016:00:00:00
Will that tool let you type an actualy function? If your variable with the characters in is named CHARVAR then this assignment statement will make the variable DATETIME have the equivalent datetime value.
datetime=dhms(input(charvar,'MMDDYY10.'),,,0);
Will that tool let you type an actualy function? If your variable with the characters in is named CHARVAR then this assignment statement will make the variable DATETIME have the equivalent datetime value.
datetime=dhms(input(charvar,'MMDDYY10.'),,,0);
Yes, @Tom is correct. The Advanced Expression window allows this:
dhms(input(t1.charvar,'MMDDYY10.'),,,0)
Looks like this in your window:
@ChrisHemedinger Are the quotes required around the format? I think it might be like the following:
dhms(input(t1.charvar, MMDDYY10.),,,0)
With the INPUT() functions you do not want the quotes around the format since the second argument is a format.
But the INPUTN() function , or the INPUTC() function, take an expression for the second argument so you do need the quotes.
This worked. I had to add DATETIME20 to the format under "Modify additional options" in Enterprise Guide.
Thanks all!
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.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.