Im using SAS 3.7 (Enterprise Edition) The time a dataset I am using has the time in military time with a format of 00:00:00.000 I am trying to format the Time in my data set into sections such as 6am-12pm = morning. I run into this error when I run my code, 71 Data TimeofDay;
72 set Airplane ;
73
74 If 00:00:00.000 <= Time <= 06:00:00.000 then Time= 'Night';
_
388
76
75 If 06:00:00.000 <= Time <= 12:00:00.000 then Time= 'Morning';
_
388
76
76 If 12:00:00.000 <= Time <= 18:00:00.000 then Time= 'Afternoon';
_
388
76
77 If 18:00:00.000 <= Time <= 24:00:00.000 then Time= 'Evening';
_
388
76
ERROR 388-185: Expecting an arithmetic operator.
ERROR 76-322: Syntax error, statement will be ignored. Here is my code: Data TimeofDay;
set Airplane ;
If 00:00:00.000 <= Time <= 06:00:00.000 then Time= 'Night';
If 06:00:00.000 <= Time <= 12:00:00.000 then Time= 'Morning';
If 12:00:00.000 <= Time <= 18:00:00.000 then Time= 'Afternoon';
If 18:00:00.000 <= Time <= 24:00:00.000 then Time= 'Evening';
Run; My question is how do I format the time in the if then statement in order to not run into this error? I've been reading solutions from other people but nothing has worked for me. I would be grateful for any response.
... View more