Statalist


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

Re: st: Adding variable from baseline file into cohort based file


From   Svend Juul <SJ@SOCI.AU.DK>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Adding variable from baseline file into cohort based file
Date   Tue, 1 Apr 2008 14:25:22 +0200

Ziad wrote:

 I tried it on dummy dataset, it matches 1 row per unique id and skips
 the other ones, please see below under 'nvp' column, any tips?

 the command is
 use testbaseline.dta
 merge using testmaster.dta,_merge(_merge)

 testbaseline: has baseline info about patients
 testmaster: has the cohort data, different time points per patient
 (i.e. different row for the same id number)


 id      nvp     vl            _merge
 1       1       12000           3
 1               123456          2
 1               7481592        2
 1               1234569       2
 2       1       12122           3
 2               654233        2
...

===============================================================

If you want to merge by id, the command is:

   merge id using ...

Hope this helps
Svend

__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone:  +45 8942 6090
Home:   +45 8693 7796
Email:  sj@soci.au.dk
__________________________________________ 


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