How can I use SAS all the time?

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

What I am trying to do is basically around the time portion to the next 30 minutes.

My question is, how can I do data rounding 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 up all the time, not five of them. I am using big data.

Thanks for your attention.

+3


source to share


2 answers


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;

      



0


source


Assuming you are asking how to do this rounding on data other than just your datalines in the example above, I suggest you split the two tasks into two different data steps.

First you create your sample data (you can exchange this for your master data later)

DATA sampledata;
    infile datalines;
    INPUT TRD_EVENT_TM hhmmss8.;
datalines;
00:14:12
00:16:12
09:01:23
09:46:32
15:59:45
;
RUN;

      



Then you round off the time variables.

data test;
    set sampledata;
    format TRD_EVENT_TM TRD_TMR time.;
    TRD_TMR = round(TRD_EVENT_TM, 1800);
run;

      

I hope this is the answer to your question.

+1


source







All Articles