Announcement

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

  • Applying condition on variable labels

    Dear stata users,
    I am curious whether it is possible to apply IF on variable labels.
    Or is there any other method, if I want to drop all the variables that have label starting with @
    If this topic has been discussed before, please refer me to the relevant forum thread
    Many thanks for your advice

  • #2
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . gen bad = 42
    
    . label var bad "@unloved, unwanted, throw this out"
    
    . ds, has(varlabel "@*")
    bad
    
    . drop `r(varlist)'
    
    . ds
    make          mpg           headroom      weight        turn          gear_ratio
    price         rep78         trunk         length        displacement  foreign

    Comment

    Working...
    X