Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index