Hello,
I need to parse out the date from a character string. The format of the variable (called "LogDate") is like this: 2/16/2019 12:00:00 AM. I just need the date part (2/16/2019).
My previous code worked, but it only parses out dates from 2019. Now that it is 2020, I need to include those dates as well. This is what I was using before:
data providers;
set dsn5;
log_part=substr(logdate, 1, index(logdate, '2019')+3);
log_date=input(log_part, mmddyy10.);
log_date=datepart(logdate);
format log_date mmddyy10.;
drop log_part logdate;
run;
The goal is to have the variable "log_date" be the date parsed out from the character string and then formatted using mmddyy10. Please let me know what you would suggest - I couldn't figure it out using other queries from the SAS community 😕
TIA!
Christine