Hi colleagues,
I have a data set (10,000 obs) like this .
Data MDI;
Input ID Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10; /*ID=Household ID*/
cards;
1 1 2 2 1 2 1 2 1 1 1
2 2 2 2 1 1 1 1 1 1 1
3 1 1 1 1 1 1 1 1 2 1
;
Run;
I need to create a new variable called deprived where deprived=1 if you get two or more 2 s for variables Q1 to Q10, else deprived =2
For instance, the new variable deprived for these three households should get following values:
For first household, deprived =1 (because there are four 2 s)
For second household, deprived =1 (because there are three 2 s)
For third household, deprived =2 (because there is only one 2 )
Could you please help me know with the codes to create the new variable called deprived?
Thanks
Neil