Hello,
I have a date variable that looks like the following:
2020-08-26 09:16:36 and it is a character
I ran the following code to try and convert the code to mmddyy10. format but it is not working.
data want;
set have;
ps_ts= substr(patient_survey_timestamp, 1, 10);
pat_suv_date = input(ps_ts, mmddyy10.);
run;
Obviously, I am applying the code incorrectly, does anyone know the correct way to run this code? Thank you
If you only want the date part of the value read with the correct informat.
one way
data example; x="2020-08-26 09:16:36"; date = input(x,yymmdd10.); format date mmddyy10.; run;
The value of the date portion of the string is in year month day order. Whey you use MMDDYY for the informat then you are reading month day year.
If you only want the date part of the value read with the correct informat.
one way
data example; x="2020-08-26 09:16:36"; date = input(x,yymmdd10.); format date mmddyy10.; run;
The value of the date portion of the string is in year month day order. Whey you use MMDDYY for the informat then you are reading month day year.
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.