[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
[email protected] |

To |
[email protected] |

Subject |
RE: Matching data, Files A &B [Was: Re: st: Picking from a matrix ] |

Date |
Thu, 28 Nov 2002 10:57:11 -0500 |

[email protected] wrote > Maybe things are simpler that I think they are but, for what > I understand of -merge-, it would merge observations that would > have similar values on one or several variables both in File A > and File B. The three variables Year, Age and Area do not exist > as such in File B: Year defines lines while columns are > combinations of Age within Area. Furthermore, there will not be > unique combinations of Year, Age and Area in A: some elements of > B will have to be copied several times to different lines of A. > Also I need to copy only one value from File B on any given line > of A, not all 770 values of a given line of B. Use Jeroen Weesie -mmerge- (available on SSC). Type -ssc desc mmerge- to see a description. The routine allows you to specify different names for the match variables in the _using_ dataset with option -umatch()-. For example, to match variables a, b, and c from the master data (your File A) with variables, d, e, and f of the using data (your File B), invoke mmerge a b c, umatch(d e f) Note that you must specify the same number of match variables in umatch() as mmerge's varlist. To handle the fact that the match variables may not form a key in the using data (File B), you can use option type() with parameter 1:n, i.e. mmerge a b c, umatch(d e f) type(1:n) the initial 1 in type() specifies that variables a b c form a key in the master data, while the n after the colon states that variables d e f do not form a key in the using data. Finally, since you are only interested in observations in the using data that are a match with the master file, specify option -unmatch(master)-. (This is not a typo, -umatch()- and -unmatch()- are different options.) Patrick Joly [email protected] [email protected] * * 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/

- Prev by Date:
**RE: Matching data, Files A &B [Was: Re: st: Picking from a matrix ]** - Next by Date:
**st: condition indices** - Previous by thread:
**RE: Matching data, Files A &B [Was: Re: st: Picking from a matrix ]** - Next by thread:
**st: condition indices** - Index(es):

© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |