Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: Merging database


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Merging database
Date   Wed, 29 Apr 2009 17:41:23 +0100

I probably didn't read Sergio's question carefully enough. 

gen id = max(v1, v2, v3) 

may be enough to do what he wants. It would be worth checking 

assert max(v1, v2, v3) == min(v1, v2, v3) 

Much more discussion of rowwise operations was given in 

SJ-9-1  pr0046  . . . . . . . . . . . . . . . . . . .  Speaking Stata: Rowwise
        (help rowsort, rowranks if installed) . . . . . . . . . . .  N. J. Cox
        Q1/09   SJ 9(1):137--157
        shows how to exploit functions, egen functions, and Mata
        for working rowwise; rowsort and rowranks are introduced


Nick 
n.j.cox@durham.ac.uk 

Nick Cox

Use -egen, group() label- or -egen, concat()-. Also study 

FAQ     . . . . . . . . . . . . . . . . . . . . . . Creating group identifiers
        3/01    How do I create individual identifiers numbered
                from 1 upwards?
                http://www.stata.com/support/faqs/data/group.html

Nick 
n.j.cox@durham.ac.uk 

SERGIO M. AFCHA CHÁVEZ

I have a little problem merging a data base. I have variables for 3 
years showing an ID:


V1  V2  V3
1     .       1
2     .       2
3    3       3
4    4        .   
.     5       5
6     .       6


I need only one ID variable. How can I obtain one column with  all the 
ID numbers?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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