Hi, how do I convert a date time value in this format (YYYY-MM-DD HH:MM:SS) into a numeric date?
When I run the below code want_str only has a "."
Thank you for your help in advance!
data have;
str="2023-02-03 15:49:06";
Want_str=input(str, mmddyy10.);
format want_str mmddyy10.;
run;
Hi @Scooby3g,
Use the proper informat:
Want_str=input(str, yymmdd10.);
(Why do you use the suffix "str" for a numeric variable?)
Hi @Scooby3g,
Use the proper informat:
Want_str=input(str, yymmdd10.);
(Why do you use the suffix "str" for a numeric variable?)
Thank you @FreelanceReinh !!!!!!
The word/acronym "Str" was just on top of my head at the moment so I just used it as an example variable name.
Posting the data step for anyone who needs it in the future!
data have;
str="2023-02-03 15:49:06";
Want_str=input(str, yymmdd10.);
format want_str mmddyy10.;
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.