<>
Eric: The "0" entry in the second row of your dataset counts as one for the
purposes of the -total- calculation with your code (which returns "9"),
which may or may not be what Tony wants...
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Eric Booth
Sent: Mittwoch, 17. Februar 2010 00:08
To: [email protected]
Subject: Re: st: quick question
>
On Feb 16, 2010, at 3:38 PM, Lachenbruch, Peter wrote:
> I would like to be able to count the number of other_rashes
I *think* you are wanting to count the number of instances of each number in
"other_rash" even if there
are multiple instances per cell. If so, here's one way to do it:
******************************
clear
input str20 other_rash
"55.1"
"0"
"17.3;49.3"
"19.2;55.2;44.2;55;66"
end
replace other_ = trim(other_)
split other_, p(";")
egen rowtotal = rownonmiss(other_rash1-other_rash`=`r(nvars)''), strok
egen total = total(rowtotal)
******************************
~ Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754
On Feb 16, 2010, at 3:38 PM, Lachenbruch, Peter wrote:
> I have a list of multiple diagnoses (rashes) and the typical one is quite
rare. I decided to simply count the number of such diagnoses. The data
look like (in the first 50 observations)
>
> +--------------------+
> | other_rash |
> |--------------------|
> 10. | 55.1 |
> 11. | 0 |
> 12. | 54.3 |
> 13. | 0 |
> 14. | 0 |
> |--------------------|
> 15. | 55.2 |
> 16. | 0 |
> 17. | 0 |
> 18. | 17.3;49.3 |
> 19. | 55.2 |
> |--------------------|
> 20. | 11.3;18.3 |
> 21. | 0 |
> 22. | 0 |
> 23. | 0 |
> 24. | 9.2;11.3;17.3 |
> |--------------------|
> 25. | 0 |
> 26. | 0 |
> 27. | 2.1 |
> 28. | 15.2;23.2 |
> 29. | 19.2;55.2 |
> |--------------------|
> 30. | 0 |
> 31. | 11.2 |
> 32. | 0 |
> 33. | 0 |
> 34. | 0 |
> |--------------------|
> 35. | 0 |
> 36. | 0 |
> 37. | 57.2 |
> 38. | 7.1;11.2;29.2;55.3 |
> 39. | 0 |
> |--------------------|
> 40. | 2.2;5.3;39.3 |
> 41. | 18.2 |
> 42. | 11.3;24.3 |
> 43. | 5.2;55.2 |
> 44. | 9.3; 10; 57.2 |
> |--------------------|
> 45. | 46.3 |
> 46. | 7.2;46.1;55.1;57.1 |
> 47. | 0 |
> 48. | 5.2;9.2;15.2 |
> 49. | 3.2;7.2;9.2 |
> |--------------------|
> 50. | 0 |
> +--------------------+
>
> I would like to be able to count the number of other_rashes - I tried to
find a string function that would do this count, I was unsuccessful. Am I
missing something? It's not crucial as I've already done this manually, but
I have several other variables to handle.
>
>
> Tony
>
> Peter A. Lachenbruch
> Department of Public Health
> Oregon State University
> Corvallis, OR 97330
> Phone: 541-737-3832
> FAX: 541-737-4001
>
*
* 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/
*
* 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/