BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
hhchenfx
Rhodochrosite | Level 12

Hi,

I want to generate a column containing time from 8:00 to 16:00 step by 1 minute.

So the data should look like:

8:00

8:01

8:02

...

15:59

16:00

Can you please help?

Thanks,

HHC

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

If you want to output multiple observations you need to execute multiple OUTPUT statements.

Can you do it now?

 

Spoiler

 

data want; 
format mytime time5.;
do time='08:00't to '16:00't by 60 ;
  mytime=time;
  output;
end;
run;

 

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

Time is enumerated in seconds. There are 60 seconds in a minute.

do time='08:00't to '16:00't by 60 ;
 ...
end;
hhchenfx
Rhodochrosite | Level 12

Thanks Tom.

How can I put put those in a table in a data step?

Of course, this one below is not working for me. Only 1 row is saved.

Thanks,

HHC

 

data want; 
format mytime time9.;
do time='08:00't to '16:00't by 60 ;
mytime=time;
end;
run;
Tom
Super User Tom
Super User

If you want to output multiple observations you need to execute multiple OUTPUT statements.

Can you do it now?

 

Spoiler

 

data want; 
format mytime time5.;
do time='08:00't to '16:00't by 60 ;
  mytime=time;
  output;
end;
run;

 

hhchenfx
Rhodochrosite | Level 12

Thank you, Tom.

HHC

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
  • 4 replies
  • 1372 views
  • 1 like
  • 2 in conversation