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: AW: RE: Consolidating two columns within the same dataset


From   "Mihai-Andrei Popescu-Greaca" <mischai@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: RE: Consolidating two columns within the same dataset
Date   Tue, 17 Aug 2010 22:25:11 +0200

Hi Nick,

Thanks for the good tip regarding the use of the max/min function!

Regards,
Mihai 

PS: I apologize for the wrong syntax by as you might noticed, I'm new "in
town".

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox
Gesendet: Dienstag, 17. August 2010 21:32
An: statalist@hsphsun2.harvard.edu
Betreff: st: RE: Consolidating two columns within the same dataset

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/


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