Announcement

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

  • Reducing the field widths of fields in Browse mode

    Hi,
    I am wondering if it is at all possible to reduce the column widths in Browse mode for variables defined with a wide field width of, for example, over 50 characters? I have read the user manual and searched the forum to no avail. It is not possible for me to define the field widths smaller as they are wide character/string fields i.e. over 100 characters wide. Using the formats command and left justifying the data in the field does not help either because the issue is with Browse mode itself, and to my understanding, it is not possible to drag a column in or out in Browse mode and make it narrower or wider respectively like you can in other software such as in SPSS or Visual Foxpro.

    Any suggestions on how to resolve this issue would be much appreciated.

  • #2
    I don't understand your problem. If you format the variable as, say, %20s, and then -browse-, you will get a narrower column in the browser and it will display just the first 20 characters of each observation. If you reduce it to %10s, you will get something narrower still, and you will see only the first 10 characters. Remember that in changing the format, you are not losing any data: you are only restricting what you see. But for all other purposes, all the original characters are still there.

    There is some minimum width, I believe it's 8 characters, below which the browser will not go. But anything larger than that is within your control.

    Also, not being a current SPSS or ever Visual Foxpro user, I don't know what you mean by "drag a column in or out in Browse mode" but if you don't want some variables displayed in the browser, just use a varlist in your browse command that doesn't include them. Try these out:
    Code:
    sysuse auto
    des make
    browse make price mpg rep78
    format make %12s // WATCH THE make COLUMN GET NARROWER
    format make %50s // WATCH THE make COLUMN GET WIDER
    // AND NOTICE THAT THE CHARACTERS NOT SHOWN AFTER format make %12s
    // ARE INDEED STILL THERE AND NOW ARE VISIBLE
    
    // SHOW ALL VARIABLES EXCEPT MAKE
    ds make, not
    browse `r(varlist)'

    Comment


    • #3
      Thanks for your assistance and suggestions.

      I should have mentioned previously that I did have a format command but have since discovered that I had put it in the wrong place in my program. I had put it on the line immediately below the variable being defined whereas it should have been placed on the line below all my other commands relating to this variable. After moving the format command and then browsing the variable in Browse, the field width was reduced. Yes, as you mentioned and as I often do, I do use a varlist in my browse command to restrict the list of variables to only those I want to view.

      What I meant by "drag a column in or out in Browse mode" was that in SPSS, VFP, Excel, Access etc, you can adjust a column's width by clicking the left mouse button on the column separator located at top of the screen in the data view window and then dragging the column separator in or out to reduce or enlarge the size of the column (or field).

      Comment

      Working...
      X