gen newvar "3+"

#1
Amateur stata user here.

I have created a new variable ("traumas") that is meant to have categories "%reporting" 0, 1, 2, or 3+ health conditions from a list of 12 pre-existing variables that are coded no(1)/yes(2) (eg anxiety, depression, addiction, etc, below as "NQ##").

Successfully wrote code for "0 of the above", "1 of the above", but having trouble for "2 of the above" or "3+ of the above".

Suggestions?

Thanks


gen traumas = 888
recode traumas 888=0 if NQ33A==1 & NQ33B==1 & NQ33C==1 & NQ33D==1 ///
& NQ33E==1 & NQ33F==1 & NQ33G==1 & NQ33H==1 & NQ33I==1 ///
& NQ33J==1 & NQ33K==1 & NQ33L==1
recode traumas 888=1 if NQ33A==2 | NQ33B==2 | NQ33C==2 | NQ33D==2 ///
| NQ33E==2 | NQ33F==2 | NQ33G==2 | NQ33H==2 | NQ33I==2 ///
| NQ33J==2 | NQ33K==2 | NQ33L==2