Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: quick question


From   Eric Booth <[email protected]>
To   [email protected]
Subject   Re: st: quick question
Date   Tue, 16 Feb 2010 17:16:30 -0600

>

After seeing Austin's post, I realized that mine doesn't ignore the instances of "0".  
If that's something you wanted to do, you could change the -split- command to:

split other_    if other_ != "0"   , p(";")

~ Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754


On Feb 16, 2010, at 5:07 PM, Eric Booth wrote:

>> 
> 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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index