Hi Colleagues,
Would appreciate if anyone of you could help on this.
I have 7000 observations like this.
data Family;
input ID Family_type;
cards;
1 1
2 1
3 1
4 2
5 3
6 4
7 6
8 5
9 6
10 4
;
run;
I need to create a new variable called ‘Type’ using the existing variable ‘Family_type’.
Condition is:
If Family_type = 2 or 3 or 4, Type = 4
All other codes of ‘Family_type’ variable should remain the same for newly created ‘Type’ variable too.
I tried the following but did not work.
data Family_1;
set Family;
if Family_type = 2 or Family_type = 3 or Family_type = 4 then Type = 4 ;
if Family_type = 1 then Type = 1;
if Family_type = 5 then Type = 5;
else Type = 6;
run;
I would appreciate if you could help me.
Thank you
Mirisage