Search code examples
timesasrounding

How Can I Round All Time Using SAS?


I have a little problem and appreciate if anyone could help me.

What I'm trying to do is basically round the time part to the nearest 30 minute.

My question is how can I do rounding data using SAS.

This is my command:

DATA sampledata;
INFORMAT TRD_EVENT_TM time10.;
FORMAT TRD_EVENT_TM TRD_TMR time14.;
INPUT TRD_EVENT_TM;
TRD_TMR = round(TRD_EVENT_TM, 1800);
INFILE;
00:14:12
00:16:12
09:01:23
09:46:32
15:59:45
;
PROC PRINT; RUN;

But I want to round all time, Not five of them.I am using big data.

Thanks for your attention.


Solution

  • data Sampledata_RT;
        set Sampledata04;
        TRD_EVENT_ROUNDED = intnx('minute30',TRD_EVENT_TM,1,'b');
        TRD_EVENT_ROUFOR = put(TRD_EVENT_ROUNDED,hhmm.);
        CountedVOLUME = TRD_PR*TRD_TUROVR;
    run;