Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: concordance


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: concordance
Date   Thu, 17 Feb 2005 07:46:20 -0500

If I understand you correctly, you want the sum of category B for each value of category A, but if a category B appears multiple times, you want to apportion its value across each occcurrence (maybe I am generalizing too much from your problem?). If that is what you want, then this should work:

bysort category_b: gen catb_count=_N
gen b2=b/catb_count
egen catb_sum=sum(b2), by(category_a)

Michael Blasnik
[email protected]



----- Original Message ----- From: "Karen Jackson" <[email protected]>
To: <[email protected]>
Sent: Thursday, February 17, 2005 5:59 AM
Subject: st: concordance



Hi,

I have a concordance (for a large number of codes) that has a structure something like this:

CATEGORY A CATEGORY B

1 10
20
30
40
-------------------------------

2 10
50
60

-------------------------------

I have values corresponding to each CATEGORY B code and want to aggregate these into CATEGORY A codes. My problem is that when the code appears in both CATEGORY A and CATEGORY B, as in the of CATEGORY B code "10", I wish to add only 50% of "10" into CATEGORY A code "1" and 50% into CATEGORY B code "2". Any ideas?

Thanks for your help,

Karen Jackson



*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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