Dear all,

I have been a long-time reader of Statalist and usually find what I need in the excellent trove of Q&A. But now, I ran into a problem where I found no answer – so this is my first post.

Here is the problem: I (quietly) run a constrained regression, looped over a few 100 sub-samples of a large data-set. In some cases, I need to display the contents of the constraints (they feed into a csv-type output in my log-file). So I define a local to hold them, but the display of negative values has proved tricky. This happens irrespective of whether I use decimal points or decimal commas. Here is a much abridged version of what I do:

Code:
. set dp period, perm    
(set dp preference recorded)
. capture drop gender
.         gen gender = 0
. constraint define 1 gender = -.12345
. constraint get 1
. local cgender = r(contents)
.         display in smcl `cgender'
0-.12345
. set dp comma, perm     
(set dp preference recorded)
.         display in smcl `cgender'
0-,12345
As you see, the minus and the leading zero are “mixed up” and show as “0-.” or “0-,”. I would need the display in a “normal” format. Any of the following would work: -0,12345 | -0.12345 | -,12345 | -.12345 . But how do I achieve that?

Thanks a lot to anybody who can help!

Malte