Statalist


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

st: Adding variable from baseline file into cohort based file


From   Ziad El-Khatib <Ziad.El-Khatib@ki.se>
To   statalist@hsphsun2.harvard.edu
Subject   st: Adding variable from baseline file into cohort based file
Date   Mon, 31 Mar 2008 18:15:12 -0700

Thank you again!
 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
 3       2       5435            3
 3               789456          2
 3               12587           2
 4       2       35645457     3
 4               963582         2
 4               951623         2
 5       3       3433            3
 5               987456        2
 5               123789        2
 6       3       2344          3
 6               963741       2
 6               159789       2
 7       1       23556        3
 7               753951       2
 7               874239       2
 8       1       4577          3
 8               9632178     2
 8               741852      2







 Thank you and best regards
 ziad




 On Sat, Mar 29, 2008 at 1:45 AM, Carlo Lazzaro <carlo.lazzaro@tin.it> wrote:
 >
 >  Dear Ziad,
 >
 >  as Svend Juul pointed out in his yesterday's reply, -merge-may be a useful
 >  tool.
 >  Otherwise, provided you have not a different number of id between baseline
 >  and follow-up, files, you can try to copy and paste educ variable (but
 >  results are usually worse than with Svend's solution).
 >
 >  Kind Regards,
 >
 >  Carlo
 >
 >  -----Messaggio originale-----
 >  Da: owner-statalist@hsphsun2.harvard.edu
 >  [mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Ziad El-Khatib
 >  Inviato: venerd́ 28 marzo 2008 22.18
 >  A: statalist@hsphsun2.harvard.edu
 >  Oggetto: st: Adding variable from baseline file into cohort based file
 >
 >  Dear STATA lister, it might be very simple question:
 >   Any tips how I can add a variable, called 'educ' from a baseline file
 >   'baseline' into follow-up file (cohort based, where patients have been
 >   followed over 12 months time)?
 >
 >   Thank you in advance and best regards
 >   ziad
 >  *
 >  *   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/
 >



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