Here is my code:
proc format ;
value militarytimeN
00:00:00 - 01:00:00 ="12am-1am"
01:00:00-02:00:00="1am-2am"
02:00:00-03:00:00="2am-3am"
03:00:00-04:00:00="3am-4am"
04:00:00-05:00:00="4am-5am"
05:00:00-06:00:00="5am-6am"
06:00:00-07:00:00="6am-7am"
07:00:00-08:00:00="7am-8am"
08:00:00-09:00:00="8am-9am"
09:00:00-10:00:00="9am-10am"
10:00:00-11:00:00="10am-11am"
11:00:00-12:00:00="11am-12pm"
12:00:00-13:00:00="12pm-1pm"
13:00:00-14:00:00="1pm-2pm"
14:00:00-15:00:00="2pm-3pm"
15:00:00-16:00:00="3pm-4pm"
16:00:00-17:00:00="4pm-5pm"
17:00:00-18:00:00="5pm-6pm"
18:00:00-19:00:00="6pm-7pm"
19:00:00-20:00:00="7pm-8pm"
20:00:00-21:00:00="8pm-9pm"
21:00:00-22:00:00="9pm-10pm"
22:00:00-23:00:00="10pm-11pm"
23:00:00-24:00:00="11pm-11:59pm";
run;
Here is my error message:
proc format ;
332 value militarytimeN
333 00:00:00 - 01:00:00 ="12am-1am"
- -
22 200
200
ERROR 22-322: Syntax error, expecting one of the following: (, ',', -, <, =.
ERROR 200-322: The symbol is not recognized and will be ignored.
333! 00:00:00 - 01:00:00 ="12am-1am"
-
22
ERROR 22-322: Syntax error, expecting one of the following: (, ',', =......
You have to express those time values with the literal format:
proc format ;
value militarytimeN
'00:00:00't - '01:00:00't ="12am-1am"
/* same for remaining values */
;
run;
But you might also want to explore what existing time formats and precision specifiers can do for you, perhaps saving the trouble of a new format.
You have to express those time values with the literal format:
proc format ;
value militarytimeN
'00:00:00't - '01:00:00't ="12am-1am"
/* same for remaining values */
;
run;
But you might also want to explore what existing time formats and precision specifiers can do for you, perhaps saving the trouble of a new format.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.