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

Hi -

 

I want to create a time matrix using the proc iml function, the ideal output would be:

 

time1    time2   time3  time4     ... time 1339 time1440

0:00     0:01     0:02    0:03      ....  23:59       24:00

 

My current codes are like this, but does not work:

proc iml;

time = {'0:00't:'24:00't};
mattrib time format =timeampm.;

create matrix var {"Time"};
append;
close matrix;

I think looping would help but not sure what extactly to do, but writing the time for 1440 times definitely is not the solution. 

Any idea?

 

Thanks!!!

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Why not post it at IML forum ? since it is about IML question.

Fixed a problem.

 

proc iml; time=do('0:00't,'24:00't,'00:01't); vname='time1':'time'+char(ncol(time)); mattrib time format=hhmm5.; create want from time[c=vname]; append from time; close; quit;

View solution in original post

2 REPLIES 2
Ksharp
Super User

Why not post it at IML forum ? since it is about IML question.

Fixed a problem.

 

proc iml; time=do('0:00't,'24:00't,'00:01't); vname='time1':'time'+char(ncol(time)); mattrib time format=hhmm5.; create want from time[c=vname]; append from time; close; quit;

panda
Quartz | Level 8

That makes sense, will do so in the future!!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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
  • 2 replies
  • 1011 views
  • 0 likes
  • 2 in conversation