SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
My_SAS
Calcite | Level 5

2012-07-11 09:43:20.55

i have used time part

it was rouging the sec based on milli seconds

i wnat the output to be

Time

------

09:43:20

2 REPLIES 2
data_null__
Jade | Level 19

Why not use the

INT function and discard the offensive decimal part.

data _null_;

   input dt anydtdtm25.;

   put (dt)(=datetime20.2);

   nomill = int(dt);

   put (nomill dt)(=datetime.);

   cards;

2012-07-11 09:43:20.55

;;;;

   run;

799  data _null_;

800     input dt anydtdtm25.;

801     put (dt)(=datetime20.2);

802     nomill = int(dt);

803     put (nomill dt)(=datetime.);

804     cards;

dt=11JUL12:09:43:20.55

nomill=11JUL12:09:43:20 dt=11JUL12:09:43:21

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 1248 views
  • 0 likes
  • 3 in conversation