Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65074

Combining two variables into one

$
0
0
I have 2 variables identifying whether someone has heard/seen a health message. I want to combine them into 1 variable. In the first variable (s339), 2853 people said Yes, they heard/saw the health message. In the second variables (s342) 577 people said yes. So the total in the new variable should be 3430.
Yet, when I use
egen HIVinfo = rowmax(s339 s342)
I get 2973 "Yes" responses not 3430 "Yes" responses

The same when I use the generate and replace commands.
Attached is the dataset and do file

Best
M

Viewing all articles
Browse latest Browse all 65074

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>