Reputation: 689
How do I set all variables to have a given number format, without having to specify the variable names? Ideally, I'd like to set something up at the beginning of my do files to set the number format for all subsequent variables created.
I'm aware of:
format var_name %12.0gc
But this seems a bit onerous, even if you can list vars.
Upvotes: 0
Views: 294
Reputation: 37208
At most the same format can be applied either to all numeric variables or to all string variables. This is the quickest way I know:
sysuse auto, clear
ds, has(type numeric)
format `r(varlist)' %2.0f
But this won't have any implications for future variables. I am not aware of any facility to set a default numeric format for new variables.
Upvotes: 1