BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anucharbe
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data x;
x='09:00:00't;
format x hhmm5.;
run;

View solution in original post

3 REPLIES 3
Reeza
Super User

What does the data look like originally?

ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Ksharp
Super User
data x;
x='09:00:00't;
format x hhmm5.;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 865 views
  • 0 likes
  • 4 in conversation