Announcement

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

  • Keeping Certain Value of a Variable

    I have a variable named "group" with values "Healthy MSCAD," "MSAD," and "BPD MSCAD." Next to type, it says byte. I would like to only keep the "BPD MSCAD" values. How would I do that? I tried the following code and it did not work:

    keep if group=="BPD MSCAD"

  • #2
    Tess:
    you seem to have a categorical variable with different (labelled) levels.
    Please note that -label- assigns names to numbers, but numbers still rule!
    Youmay want to consider the following toy-example:
    Code:
    . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
    (1978 automobile data)
    
    . g rep78_bis=rep78
    (5 missing values generated)
    
    . keep if rep78_bis==4
    (56 observations deleted)
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X