Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: Consolidating two columns within the same dataset


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Consolidating two columns within the same dataset
Date   Tue, 17 Aug 2010 20:31:42 +0100

Stata has no concept of columns or rows, except for matrices. However, let's presume that you mean variables and observations.

You don't say what is in the gaps. If it's missing numeric values, 

. gen C = max(A, B) 

will suffice, as indeed will -min(A, B)-. Either will do because both -max()- and -min()- ignore missings unless all their arguments are missing. 

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

Mihai-Andrei Popescu-Greaca

Here a question regarding data management: How can I combine the columns A &
B (only one value/row) together to form column C?
A    B    C (desired)
1          1
1          1
1          1
1          1
1          1
2          2
      2    2
      2    2
      1    1
      1    1
      2    2


*
*   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–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index