Hello colleagues,
I have over 10,000 data set related to Material Deprivation like this .
Data MD;
Input ID Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10; /*ID=Household ID*/
cards;
1 2 2 1 1 7 8 9 1 1 9
2 2 2 2 1 1 1 1 7 8 9
3 7 8 9 7 8 9 7 8 9 2
4 1 1 1 1 1 1 1 1 1 1
;
Run;
Note: Responses 7, 8, and 9 are don’t know, refusal and not stated respectively.
I need to create a new variable called deprived where deprived=1 if you get two or more ‘2’ s for a given household across variables Q1 to Q10, else deprived =2
For instance, the new variable deprived for these four households should get following values:
For first household, deprived =1 (because there are two ‘2’ s)
For second household, deprived =1 (because there are three ‘2’ s)
For third household, deprived =2 (because there is only one ‘2’ )
For third household, deprived =2 (because there are no “two or more ‘2’ s”)
Could you please help me know with the codes to create the new variable called deprived?
Thanks
Neil