I am working with an assignment.
Here is the code-
data XXX;
81 infile datalines;
82 length time 8;
83 informat time time5.;
84 format time time5.;
85 input @1time @8With $5.;
I want the time as in this format-
11:00
9:00
3:00
I tried many different set of codes but I could not find a code which would provide the desired output.
Please help me if you could.
Thanks
Anu
data x;
x='09:00:00't;
format x hhmm5.;
run;
What does the data look like originally?
Hi Anu,
Do you have an external file that you're reading this data from? Can you post a portion of that?
And are you looking to represent clock times (9:00 AM or 13:00 24-hr time)? Or something like a time span (6:45 for 6 hrs, 45min)?
What's the "WITH" variable?
Chris
data x;
x='09:00:00't;
format x hhmm5.;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.