BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
thesasuser
Lapis Lazuli | Level 10

Tring to importime with the following format. have about 1000 rows of data.

 

data tm_data;
informat pid $4. stm etm stimer8.;
format stm etm mmss.;
infile datalines truncover;
input pid stm etm;

datalines;
2867 0:25 00:25
2936 8:47 10:03
3015 8:45 10:01
3088 8:44 10:00
3161 8:46 10:03
3234 8:43 9:59
....

....
;
run;

 

This does not seem to work

Can anybody help

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

by any chance you want this?

 

data tm_data;
informat pid $4. stm etm time5.;
format stm etm time5.;
infile datalines truncover;
input pid stm etm;
datalines;
2867 0:25 00:25
2936 8:47 10:03
3015 8:45 10:01
3088 8:44 10:00
3161 8:46 10:03
3234 8:43 9:59
;
run;

View solution in original post

5 REPLIES 5
novinosrin
Tourmaline | Level 20

by any chance you want this?

 

data tm_data;
informat pid $4. stm etm time5.;
format stm etm time5.;
infile datalines truncover;
input pid stm etm;
datalines;
2867 0:25 00:25
2936 8:47 10:03
3015 8:45 10:01
3088 8:44 10:00
3161 8:46 10:03
3234 8:43 9:59
;
run;
thesasuser
Lapis Lazuli | Level 10

Thanks it worked.
Adjusted space between columns to a single space

novinosrin
Tourmaline | Level 20

Ok I am glad. I hope you noticed the use of time5. informat in the solution I provided as opposed to stimer that you used. I assumed you wanted time5 rather. 

novinosrin
Tourmaline | Level 20

Your code worked fine too.

 

1643 data tm_data;
1644 informat pid $4. stm etm stimer8.;
1645 format stm etm mmss.;
1646 infile datalines truncover;
1647 input pid stm etm;
1648 datalines;

NOTE: The data set WORK.TM_DATA has 6 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1279 views
  • 0 likes
  • 3 in conversation