I want to generate 3 NEW variables using these variables in my data set:
- Ucod
- 19 variables in series by this name: Record_2, Record_3......Record_20
Both of them have values in alphanumerical format in it, basically ICD codes i.e, I150 I want to generate 3 new variables satisfying each of three new condition:
- People dying primarily of COVID (Var1=1 if Ucod= U07.1)
- People dying of a non-COVID condition WITH covid (Var2=1 IF Ucod != U07.1 & Record_2/20= U07.1)
- People dying of a non-COVID condition WITHOUT covid (Var3=1 if Ucod != U07.1 & Record_2/20 != U07.1)
Can anyone suggest a code which can help me to generate these 3 variables using these 3 condition.