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

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


From   Benoit.Laplante@inrs-UCS.uquebec.ca
To   statalist@hsphsun2.harvard.edu
Subject   RE: Matching data, Files A &B [Was: Re: st: Picking from a matrix]
Date   Thu, 28 Nov 2002 10:28:22 -0500

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.

B. Laplante

-----Message d'origine-----
De : Stephen P. Jenkins [mailto:stephenj@essex.ac.uk]
Envoyé : jeudi 28 novembre 2002 10:12
À : statalist@hsphsun2.harvard.edu
Objet : Matching data, Files A &B [Was: Re: st: Picking from a matrix]


On Thu, 28 Nov 2002 09:37:40 -0500 Benoit.Laplante@inrs-ucs.uquebec.ca 
wrote:

> This is not a follow-up to the SAS vs Stata thread, although it may end up
> that way :-)
> 
> I have two files, say File A and File B.
> 
> File A is set for survival analysis with multiple records per individual.
> Among others, it contains three variables: Year, Age and Area. File B
> contains annual aggregated data that describe some higher level
> characteristic that I want to use as a regressor. Each line of B refers to
a
> calendar year, each column of B to age (in year) within one area. The
value
> of the regressor, for each record, is the element (Year-1, Age in Area) in
> File B. I want to copy the appropriate value from B to the the appropriate
> line of the regressor column in A.

Don't you just need to -merge- File B onto File A using the relevant 
year, age, area variables as the keys?  And then do the regression.
Or am I missing something?

Stephen
----------------------
Professor Stephen P. Jenkins <stephenj@essex.ac.uk>
Institute for Social and Economic Research (ISER)
University of Essex, Colchester, CO4 3SQ, UK
Tel: +44 (0)1206 873374. Fax: +44 (0)1206 873151.
http://www.iser.essex.ac.uk

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index