f



covert standard time (AMPM time) to Military time

What is the best way to covert standard time (AMPM time) to Military time?

data test;
input

@1 mytime 5.;
@6 ampm   $2.;

cards;
04:20AM
07:30PM
05:27AM
00:00PM
01:00AM
12:49AM
12:59PM   ;
run;
0
2/12/2010 8:22:34 AM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

2 Replies
1118 Views

Similar Articles

[PageSpeed] 24

Hi Lee,

Try this...
data test;
input @1 mytime $ 5.
@6 ampm   $2.;
new=compress(mytime||ampm);
new_var=input(new,time8.);
format new_var time.;
cards;
04:20AM
07:30PM
05:27AM
00:00PM
01:00AM
12:49AM
12:59PM
;
run;
0
2/12/2010 9:51:30 AM
On Feb 12, 1:22=A0am, hummingbird10...@HOTMAIL.COM (Annie Lee) wrote:
> What is the best way to covert standard time (AMPM time) to Military time=
?
>
> data test;
> input
>
> @1 mytime 5.;
> @6 ampm =A0 $2.;
>
> cards;
> 04:20AM
> 07:30PM
> 05:27AM
> 00:00PM
> 01:00AM
> 12:49AM
> 12:59PM =A0 ;
> run;

data test;
input @1 mytime time5.
      @6 ampm   $2.
      ;

if ampm =3D 'PM' then
   mytime =3D mytime + 43200 ;

   put mytime=3D time5.;
datalines;
04:20AM
07:30PM
05:27AM
00:00PM
01:00AM
12:49AM
12:59PM
;;;;
run;

0
savian.net (255)
2/12/2010 1:03:27 PM
Reply: