I have time like this:
TIME
23AUG2013:15:12:00.000
28AUG2013:19:22:00.000
If i want to remove the record where timpepart is zeros.....
data want;
set have;
where timepart(TIME) ne 0)); /*why just a single zero is enough*/
run;
why cant I do:
data want;
set have;
where timepart(TIME) ne 00:00:00.000));
run;
SAS stores dates, time and datetime values as numeric. It is merely a format that converts the value to something meaningful to the human.
A date, is the number of days since 01JAN1960
A time, is the number of seconds(floats for fractions of seconds) since 00:00:00.000
A datetime, is the number of seconds since 01JAN1960:00:00:00.000
data _null_;
date="01FEB2011"d;
put date=; /* shows the unformated value of date, that is the number of days between 01jan1960 and 01feb2011 */
time="00:10:05.03"t;
put time=; /* shows the unformated number of seconds since 00:00:00.000 after 10 minutes 5 seconds and .03 hundredth of seconds */
datetime="01FEB2011:00:10:05.03"dt;
put datetime=;
run;
So 00:00:00.000 is not an interpretable number by SAS. You could do where timepart(time) NE "00:00:00.000"t; but then that would simply be you asking SAS to convert "00:00:00.000" to its own representation of counting seconds. Since it is known/documented how it is counted, we know it's equal to 0 in its internal representation and thus simply write where timepart(time) NE 0;
SAS stores dates, time and datetime values as numeric. It is merely a format that converts the value to something meaningful to the human.
A date, is the number of days since 01JAN1960
A time, is the number of seconds(floats for fractions of seconds) since 00:00:00.000
A datetime, is the number of seconds since 01JAN1960:00:00:00.000
data _null_;
date="01FEB2011"d;
put date=; /* shows the unformated value of date, that is the number of days between 01jan1960 and 01feb2011 */
time="00:10:05.03"t;
put time=; /* shows the unformated number of seconds since 00:00:00.000 after 10 minutes 5 seconds and .03 hundredth of seconds */
datetime="01FEB2011:00:10:05.03"dt;
put datetime=;
run;
So 00:00:00.000 is not an interpretable number by SAS. You could do where timepart(time) NE "00:00:00.000"t; but then that would simply be you asking SAS to convert "00:00:00.000" to its own representation of counting seconds. Since it is known/documented how it is counted, we know it's equal to 0 in its internal representation and thus simply write where timepart(time) NE 0;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.