I’m having some difficulty creating a new variable from three others.
All variables are of binary type (values 0 or 1).
They are a result of an analysis of a set of variables (Like an indicator). For instance:
gen alerta_rec = a1maoseoupesfrios+ a3noudornoestmago+ a2bocaseca+ a4aumentodesudorese+ a5tensomuscular+ a6apertonamandbula+ a7diarreiapassageira+ a8inosnia+ a9taquicardia+ a10respiracaoofegante+ a11hipertensaosubita+ a12mudancadeapetite+ a13aumentosubitodemotivacao+ a14entusiasmosubito+ a15vontadesubita
gen alerta_id = alerta_rec
recode alerta_id 0/6=0 7/max=1
When I create a table with them, they show this:
I’d like to create a variable which shows the total of individuals that agree with at least one of the three originals items (which would be 66), but it doesn't work!
gen lipp_status=0
replace lipp_status=1 if alerta_id==1 | resistencia_id==1 | exaustao_id==1
tab lipp_status
How can I solve this?
Thank you
All variables are of binary type (values 0 or 1).
They are a result of an analysis of a set of variables (Like an indicator). For instance:
gen alerta_rec = a1maoseoupesfrios+ a3noudornoestmago+ a2bocaseca+ a4aumentodesudorese+ a5tensomuscular+ a6apertonamandbula+ a7diarreiapassageira+ a8inosnia+ a9taquicardia+ a10respiracaoofegante+ a11hipertensaosubita+ a12mudancadeapetite+ a13aumentosubitodemotivacao+ a14entusiasmosubito+ a15vontadesubita
gen alerta_id = alerta_rec
recode alerta_id 0/6=0 7/max=1
When I create a table with them, they show this:
alerta_id | n | % |
0 | 101 | 89.4 |
1 | 12 | 10.6 |
113 |
resistencia_id | n | % |
0 | 70 | 61.9 |
1 | 43 | 38.1 |
113 |
exaustao_id | n | % |
0 | 102 | 90.3 |
1 | 11 | 9.7 |
113 |
gen lipp_status=0
replace lipp_status=1 if alerta_id==1 | resistencia_id==1 | exaustao_id==1
tab lipp_status
lipp_status | n | % |
0 | 69 | 61.1 |
1 | 44 | 38.9 |
113 |
Thank you
Comment