Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Set a maximum width for variables in the Data Browser

    Hello,

    This is a very simple question that would save me a lot of time and it doesn't require any data example. I'm working with string variables that can sometimes be very long, which makes the Data Browser quite hard to analyze. I don't mind having the string values being incompletely displayed. I'm just looking for a line of code I can write at the beginning of my do-file that will tell Stata not to have any variable have a length of more than x in the data browser. I tried -compress- but this only reduce the excess length. It would save me many hours from manually dragging the mouse in the data browser to have the desired width.

    Please note that I'm not trying to modify the actual content of my values in any way, just to make them systematically shorter on the Data Browser.

    Thanks a lot for the help !
    Last edited by Thomas Brot; 01 Mar 2023, 06:31.

  • #2
    Code:
    // find all string variables
    ds , has(type string)
    
    // display the first 10 characters
    format `r(varlist)' %-10s
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment

    Working...
    X