Statalist


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

st: AW: Merging database


From   Jochen Späth <[email protected]>
To   <[email protected]>
Subject   st: AW: Merging database
Date   Wed, 29 Apr 2009 18:36:11 +0200

Hello Sergio,

I'm not quite sure of what your problem is, maybe it would help if you were a little more precise.

Below, I assumed that the example you gave is AFTER your three data sets have been merged, with v1 coming from the first, v2 from the second and v3 from the third and with v1, v2 and v3 denoting all the same ID. If this is the case you could 

-replace v1 = v2 if v1 == . & v2 != .-
-replace v1 = v3 if v1 == . & v2 ==. & v3 != .-
-count if v1 == .- /* should return 0, otherwise there are observations in your data that are not uniquely determined by either of your three ID variables.*/
-drop v2 v3- /* of course, only if you got all IDs caught in v1 */

HTH,
Jochen

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von "SERGIO M. AFCHA CHÁVEZ"
Gesendet: Mittwoch, 29. April 2009 17:55
An: [email protected]
Betreff: st: Merging database

Dear Statlisters,

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?

Thanks in advance for your help.

Sergio 


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

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