Announcement

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

  • Strip off label

    Hi statalist community,

    How to strip off labels (one values) from numeric variable? Such that string only has numbers (no labels)
    Last edited by ajay pasi; 04 Nov 2022, 00:26.

  • #2
    I get it _strip_labels varlist

    Comment


    • #3
      The output of help label is where I would begin in looking for advice on dealing with value labels and variable labels. It tells us that
      Code:
      label values varlist .
      will do what is desired.
      Code:
      . sysuse auto, clear
      (1978 automobile data)
      
      . describe rep78 foreign
      
      Variable      Storage   Display    Value
          name         type    format    label      Variable label
      ------------------------------------------------------------------------------------------------
      rep78           int     %8.0g                 Repair record 1978
      foreign         byte    %8.0g      origin     Car origin
      
      . label values rep78 foreign .
      
      . describe rep78 foreign
      
      Variable      Storage   Display    Value
          name         type    format    label      Variable label
      ------------------------------------------------------------------------------------------------
      rep78           int     %8.0g                 Repair record 1978
      foreign         byte    %8.0g                 Car origin
      
      .
      Code:
      . sysuse auto, clear
      (1978 automobile data)
      
      . describe rep78 foreign
      
      Variable      Storage   Display    Value
          name         type    format    label      Variable label
      ------------------------------------------------------------------------------------------------
      rep78           int     %8.0g                 Repair record 1978
      foreign         byte    %8.0g      origin     Car origin
      
      . _strip_labels rep78 foreign
      
      . describe rep78 foreign
      
      Variable      Storage   Display    Value
          name         type    format    label      Variable label
      ------------------------------------------------------------------------------------------------
      rep78           int     %8.0g                 Repair record 1978
      foreign         byte    %8.0g                 Car origin
      
      .

      Comment


      • #4
        Thanks William.

        Comment

        Working...
        X