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
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 to share