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

Re: st: Merging files


From   Rafal Raciborski <[email protected]>
To   [email protected]
Subject   Re: st: Merging files
Date   Wed, 16 Feb 2005 20:10:30 -0500

If you merge by zip code, the number of organizations will "spread over"
identical zip codes so you should not encounter any problems.  See below,
respondent 1 and 4 have the same number of organizations and so do respondents
2 and 5.
rafal


. use C:\temp\using.dta, clear
. list

     +----------------+
     |   zip   no_org |
     |----------------|
  1. | 12345       23 |
  2. | 23456       41 |
  3. | 34567       19 |
  4. | 56789       56 |
     +----------------+

. sort zip
. save, replace
.
. use C:\temp\master.dta, clear
. list

     +-----------------+
     | resp_id     zip |
     |-----------------|
  1. |       1   12345 |
  2. |       2   23456 |
  3. |       3   34567 |
  4. |       4   12345 |
  5. |       5   23456 |
     |-----------------|
  6. |       6   56789 |
     +-----------------+

. sort zip

. merge zip using C:\temp\using.dta
. sort resp_id zip
. list

     +-----------------------------------+
     | resp_id     zip   no_org   _merge |
     |-----------------------------------|
  1. |       1   12345       23        3 |
  2. |       2   23456       41        3 |
  3. |       3   34567       19        3 |
  4. |       4   12345       23        3 |
  5. |       5   23456       41        3 |
     |-----------------------------------|
  6. |       6   56789       56        3 |
     +-----------------------------------+



================
Rafal Raciborski
Graduate student
Department of Political Science
Emory University
301 Tarbutton Hall
1555 Dickey Drive
Atlanta, GA 30322
404-378-9826 (home)
[email protected] (e-mail)
www.roofoos.net

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