Hello there
I'm hoping someone may be able to confirm/deny whether I've used the rcount() function correctly to derive a new count variable.
I have a list of 17 variables used to define individual diseases that I would like to derive into a single count variable to determine the number of diseases present in each respondent. These variables take the form a_hcond1 - a_hcond17 (example using first 8 variables below). The variables are stored as bytes with label values -9 "missing", -7 "proxy respondent" -3 "refused" -1 "dont know" 0 "absent" 1 "present"
I wish to know how many times each individual responded "present" to the 17 diseases, to give a count of their total number of diseases - in order to evaluate 'multimorbidity' based on number of disease present.
I used the rcount() function as follows and received the corresponding output when tabulating the data:
The output seems ok, but my very basic knowledge means I'm slightly unsure if I have applied this correctly. Does this output mean that e.g. 13,219 respondents answered "present" to only 1 disease, 5120 answered "present" to 2 diseases etc...
Any help would be much appreciated.
Lewis
I'm hoping someone may be able to confirm/deny whether I've used the rcount() function correctly to derive a new count variable.
I have a list of 17 variables used to define individual diseases that I would like to derive into a single count variable to determine the number of diseases present in each respondent. These variables take the form a_hcond1 - a_hcond17 (example using first 8 variables below). The variables are stored as bytes with label values -9 "missing", -7 "proxy respondent" -3 "refused" -1 "dont know" 0 "absent" 1 "present"
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(a_hcond1 a_hcond2 a_hcond3 a_hcond4 a_hcond5 a_hcond6 a_hcond7 a_hcond8) 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 1 1 0 0 0 0 0 0 -7 -7 -7 -7 -7 -7 -7 -7 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -7 -7 -7 -7 -7 -7 -7 -7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 end label values a_hcond1 a_hcond1 label def a_hcond1 -7 "proxy respondent", modify label def a_hcond1 0 "not mentioned", modify label def a_hcond1 1 "Mentioned", modify label values a_hcond2 a_hcond2 label def a_hcond2 -7 "proxy respondent", modify label def a_hcond2 0 "not mentioned", modify label def a_hcond2 1 "Mentioned", modify label values a_hcond3 a_hcond3 label def a_hcond3 -7 "proxy respondent", modify label def a_hcond3 0 "not mentioned", modify label def a_hcond3 1 "Mentioned", modify label values a_hcond4 a_hcond4 label def a_hcond4 -7 "proxy respondent", modify label def a_hcond4 0 "not mentioned", modify label def a_hcond4 1 "Mentioned", modify label values a_hcond5 a_hcond5 label def a_hcond5 -7 "proxy respondent", modify label def a_hcond5 0 "not mentioned", modify label def a_hcond5 1 "Mentioned", modify label values a_hcond6 a_hcond6 label def a_hcond6 -7 "proxy respondent", modify label def a_hcond6 0 "not mentioned", modify label def a_hcond6 1 "Mentioned", modify label values a_hcond7 a_hcond7 label def a_hcond7 -7 "proxy respondent", modify label def a_hcond7 0 "not mentioned", modify label def a_hcond7 1 "Mentioned", modify label values a_hcond8 a_hcond8 label def a_hcond8 -7 "proxy respondent", modify label def a_hcond8 0 "not mentioned", modify
I used the rcount() function as follows and received the corresponding output when tabulating the data:
Code:
egen LTC_count = rcount(a_hcond1 - a_hcond17), cond(@==1) . tab LTC_count LTC_count | Freq. Percent Cum. ------------+----------------------------------- 0 | 28,751 56.38 56.38 1 | 13,219 25.92 82.30 2 | 5,120 10.04 92.34 3 | 2,265 4.44 96.79 4 | 919 1.80 98.59 5 | 420 0.82 99.41 6 | 164 0.32 99.73 7 | 84 0.16 99.90 8 | 28 0.05 99.95 9 | 14 0.03 99.98 10 | 10 0.02 100.00 ------------+----------------------------------- Total | 50,994 100.00
Any help would be much appreciated.
Lewis
Comment