Search code examples
sas

How to display time without colon in sas


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


Solution

  • 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