Complete the sequence with
(1)
. di 54,321
54 321
(2)
. di "54,231"
54,321
display
interprets (1) as an instruction to display two arguments, one by one. You get the same result with your last line as (first) the local macro test
was evaluated and (second) display
saw the result of the evaluation.
The difference when quotation marks are supplied is that thereby you insist that the argument is a literal string. You get the same result with your first display
command for the same reasons as just given.
In short, the use of local macros here is quite incidental to the differences in results. display
never sees the local macro as such; it just sees its contents after evaluation. So, what you are seeing pivots entirely on nuances in what is presented to display
.
Note further that while you can use a display format in defining the contents of a local macro, that ends that story. A local does not have an attached format that sticks with it. It's just a string (which naturally may mean a string with numeric characters).