mardi 25 mai 2021

Stata: Using if with value labels

I faced an issue using if with value labels.

set obs 5
gen var1 = _n
label define l_var1 1 "cat1" 2 "cat1" 3 "cat2" 4 "cat3" 5 "cat3"
label val var1 l_var1
keep if var1=="cat3":l_var1
(4 observations deleted)

I expected 3 records to be deleted. How can I achieve this?

I am using Stata 16.1.

Aucun commentaire:

Enregistrer un commentaire