Announcement

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

  • Delete part of variable label

    Hi,

    I have 10 variables labeled starting with "xx/" and ending different "xx/J7G" or "xx/K6E". How can I delete - hopefully in a loop - the "xx/" part of every label? I already googled but could not find anything working.

    -Nick

  • #2
    Code:
    foreach var of varlist <my 10 variables> {
        local variable_label : variable label `var'
        local variable_label : subinstr local variable_label "xx/" ""
        label variable `var' "`variable_label'"
    }

    Comment


    • #3
      Thank you so much! Sometimes it is so easy.

      Comment

      Working...
      X