Reputation: 317
how can I display range of time with no colon?
data alltime;
do hr = '00:00:00't to '23:59:59't;
output; end; format hr time8.; run;
02:23:30 => 022330
Upvotes: 0
Views: 2606
Reputation: 708
You can use the CAT function in SAS to concatenate the hours, minutes, and seconds components of the time value.
data alltime;
format hr time8.;
do hr = '00:00:00't to '23:59:59't;
time_str = cat(of hour(hr) minute(hr) second(hr), ' ');
output;
end;
drop hr;
run;
Upvotes: -1
Reputation: 1
Toe remove colon %let systm=%sysfunc(compress(%sysfunc(tranwrd(%sysfunc(datetime(),datetime26.),:,)))); %put =&systm;
SYMBOLGEN: Macro variable SYSTM resolves to 23JUN2023101122 =23JUN2023101122
Upvotes: 0
Reputation: 317
it worked out like that:
data alltime;
do hr = '00:00:00't to '23:59:59't;
output; end; format hr b8601tm8.; run;
Upvotes: 0
Reputation: 51581
How about B8601TM6.
format?
data _null_;
do hr = '00:00:00't to '23:59:59't by 65*60+23 ;
put hr time8. '->' hr b8601tm6. ;
end;
run;
Results:
0:00:00->000000
1:05:23->010523
2:10:46->021046
3:16:09->031609
4:21:32->042132
5:26:55->052655
6:32:18->063218
7:37:41->073741
8:43:04->084304
9:48:27->094827
10:53:50->105350
11:59:13->115913
13:04:36->130436
14:09:59->140959
15:15:22->151522
16:20:45->162045
17:26:08->172608
18:31:31->183131
19:36:54->193654
20:42:17->204217
21:47:40->214740
22:53:03->225303
23:58:26->235826
Upvotes: 4