[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Columns of binary variable
From
john metcalfe <[email protected]>
To
[email protected]
Subject
st: Columns of binary variable
Date
Sat, 28 Feb 2009 12:04:40 -0800
> Dear Statalist,
> I have 11 columns of binary variables as per the example below. This may be a very straightforward question, but is there a way to generate a new variable that represents the number of 1's in each row for each individual?
> Many thanks,
> John
>
>
>
> 1. 0 0 0 0 0 . 0 0 0 0 0
> 2. 1 1 1 0 0 0 0 0 0 0 0
> 3. 1 1 1 0 0 0 0 0 0 0 .
> 4. 0 1 1 . . . . . . . .
> 5. 1 1 1 . 1 0 1 0 1 . .
> 6. 1 0 0 . . . . . . . .
> 7. 0 1 1 0 0 . 0 0 0 0 0
> 8. 0 1 0 0 0 . 0 0 0 0 0
> 9. 0 1 1 0 . 0 0 0 0 0 0
> 10. 0 0 0 . . . . . . . .
> 11. 0 0 0 0 0 0 0 0 0 0 0
> 12. 0 1 1 . 0 0 0 0 0 . .
> 13. 0 1 1 0 0 0 0 0 0 0 0
> 14. 0 1 1 0 0 0 0 0 0 0 0
> 15. 0 0 0 1 . 0 0 0 . 0 .
> 16. 0 0 0 . . . . . . . .
> 17. 1 1 1 0 0 0 0 1 0 . .
> 18. 0 0 1 0 0 0 0 0 0 0 0
> 19. 0 0 1 0 0 0 0 0 0 . .
> 20. 1 0 0 0 . . . 0 0 . 0
> 21. 0 0 1 1 1 . 1 0 1 0 0
> 22. . 1 1 0 1 0 0 0 1 0 0
> 23. 0 0 1 0 0 0 0 0 1 . .
> 24. 0 1 0 0 0 . 0 0 0 0 0
> 25. 0 0 0 1 0 0 0 0 0 1 1
> 26. 0 0 0 . . . . . . . .
> 27. 0 0 1 1 0 0 0 0 0 0 0
> 28. 0 0 0 0 1 0 0 0 0 0 0
> 29. . 1 0 0 0 0 0 0 0 0 0
> 30. 1 0 0 0 0 0 0 0 0 0 0
> 31. 0 1 1 0 0 0 0 0 0 0 0
> 32. 1 1 1 1 0 1 0 1 1 0 0
> 33. 1 1 1 0 0 0 0 0 0 0 0
> 34. 0 0 0 . . . . . . . .
> 35. 0 0 0 . . . . . . . .
> 36. 0 1 1 0 1 0 1 0 1 1 1
> 37. 0 0 1 0 . . 0 . . 0 .
>
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |