Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: RE: quick question
From
"Lachenbruch, Peter" <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: RE: quick question
Date
Wed, 17 Feb 2010 09:16:06 -0800
This seems to be the simplest solution. Need to fuss a bit about the 0 values as Martin says.
Tony
Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Tuesday, February 16, 2010 3:11 PM
To: [email protected]
Subject: st: RE: quick question
<>
You may also like the "noccur" function from NJC`s -egenmore- for this
purpose (with some fiddling afterwards):
*******
clear*
input str30 other_rash
" 55.1 "
" 0 "
" 54.3 "
" 0 "
" 0 "
" 55.2 "
" 0 "
" 0 "
" 17.3;49.3 "
" 55.2 "
" 11.3;18.3 "
" 0 "
" 0 "
" 0 "
" 9.2;11.3;17.3 "
" 0 "
" 0 "
" 2.1 "
" 15.2;23.2 "
" 19.2;55.2 "
" 0 "
" 11.2 "
" 0 "
" 0 "
" 0 "
" 0 "
" 0 "
" 57.2 "
" 7.1;11.2;29.2;55.3 "
" 0 "
" 2.2;5.3;39.3 "
" 18.2 "
" 11.3;24.3 "
" 5.2;55.2 "
" 9.3; 10; 57.2 "
" 46.3 "
" 7.2;46.1;55.1;57.1 "
" 0 "
" 5.2;9.2;15.2 "
" 3.2;7.2;9.2 "
" 0 "
end
compress
replace other_rash=trim(other_rash)
egen countrashes= noccur(other_rash), string(";")
replace countrashes=countrashes+1 /*
*/ if countrashes>0
replace countrashes=1 if countrashes==0 & /*
*/ other_rash!="0"
l, noo h(25)
*******
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Lachenbruch,
Peter
Sent: Dienstag, 16. Februar 2010 22:38
To: [email protected]
Subject: st: quick question
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/
*
* 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/