I am converting data from an external source and have to guess an appropriate Stata variable format automatically. Neither f nor g format seems to be a good fit for my task, but perhaps one can advise. The problem is that I don't know the overall width of the number, but just the number of decimals. For example, 2 digits after comma. I do want trailing zeroes to appear. So for a list of numbers 1, 1.03, 11.36, 1000.9, 0.04, 0.2 I wish to see:
I can specify something like %25.2f, and it works fine in the list command, but the columns will be very wide and inconvenient in browse window. See for example the variable headroom formatted with %25.2f here:

I do prefer the list's behavior over browse's behavior as it produces more compact and usable output. Ideally, I would like to specify something like: %*.2f, which is to say determine the width as needed, and always show 2 decimals. Is there anything like this I could employ?
Thank you, Sergiy Radyakin
Code:
1.00 1.03 11.36 1000.90 0.04 0.20
I do prefer the list's behavior over browse's behavior as it produces more compact and usable output. Ideally, I would like to specify something like: %*.2f, which is to say determine the width as needed, and always show 2 decimals. Is there anything like this I could employ?
Thank you, Sergiy Radyakin
Comment