Announcement

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

  • Quick way to format all string variables to the length of the longest observation

    Dear all
    is there a quick command to reformat string variables to be the length of the longest observed value of each, or is the only way to find the longest string length for each and format variable by variable?
    Thanks

  • #2
    Using the compress command on a string variable to shorten it to the length of the longest value will also alter the variable's format to match its new length, for variables 9 characters in length or longer.

    It is not clear to me what problem you hope to solve by choosing shorter formats for your string variables.

    Or when you use the word "reformat" do you mean "shorten the variable from, say, str100 to str20" rather than, as I understood your question, "change the variable format from %100s to %20s"?

    Comment

    Working...
    X