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

RE: st: Re: Merging and counting variables


From   "DE S" <[email protected]>
To   [email protected]
Subject   RE: st: Re: Merging and counting variables
Date   Fri, 23 Sep 2005 13:40:57 -0400

Michael,

I will give that a try.  Thank you very much for your help.

Dari


From: "Michael Blasnik" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: Re: Merging and counting variables
Date: Fri, 23 Sep 2005 13:33:49 -0400

It's not clear if you really want the merged dataset or just the count. If you want the merged dataset, what is it about the -merge- command you can't figure? If you just want the count, you could:

1) create a dataset with the counts by county/state:

use associations
bysort countystate: gen count=_N
by countystate: keep if _n==1
sort countystate
save associationcount

2) merge that dataset into the master dataset

use master
sort countystate
merge countystate using associationcount


Michael Blasnik
[email protected]

----- Original Message ----- From: "DE S" <[email protected]>
To: <[email protected]>
Sent: Friday, September 23, 2005 12:36 PM
Subject: st: Merging and counting variables



Hello Statalisters,

I've reviewed the Stata Manual and to no avail. Here is my question.

I have a master set with R county and states. County and State are appended to read, "New YorkNY", for example. I also have an association dataset that lists all national organizations and their corresponding county/state, also appended as "New YorkNY." I want to merge the datasets and find out how many associations exist in each respondent's county. For example, if R1 lives in NY, NY, I want to have a variable that will spit out "100" for the 100 organizations that exist there.

I'd appreciate your help immensely.

Thank you,
Dari E. Sylvester

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

*
* 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/
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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