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


From   "Mihai-Andrei Popescu-Greaca" <[email protected]>
To   <[email protected]>
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: [email protected]
[mailto:[email protected]] Im Auftrag von Nick Cox
Gesendet: Dienstag, 17. August 2010 21:32
An: [email protected]
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 
[email protected] 

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