Hello everyone,
I'm facing an issue with reading datetime and timezone value into SAS as a character.
data a;
input abc : $100.;
informat abc $100.;
format abc $100.;
cards;
2023-11-11 11:06:35.140028 America/New_York
;
run;
When I execute the above, SAS is not reading the entire value. It is just reading the date. Could anyone please help.
Thanks so much.
Because you told it to use LIST MODE input by using the colon modifier in the INPUT statement it stopped at the first delimiter character, space. Use FORMATTED MODE input. But you might want to add an INFILE statement so you can add the TRUNCOVER option since data lines are a always a multiple of 80 bytes long.
Note there is no need to attach either an informat or a format to that variable. SAS does not need to be given special instructions for how to read or write normal strings.
data a;
infile cards truncover;
input abc $100.;
cards;
2023-11-11 11:06:35.140028 America/New_York
;
Because you told it to use LIST MODE input by using the colon modifier in the INPUT statement it stopped at the first delimiter character, space. Use FORMATTED MODE input. But you might want to add an INFILE statement so you can add the TRUNCOVER option since data lines are a always a multiple of 80 bytes long.
Note there is no need to attach either an informat or a format to that variable. SAS does not need to be given special instructions for how to read or write normal strings.
data a;
infile cards truncover;
input abc $100.;
cards;
2023-11-11 11:06:35.140028 America/New_York
;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.