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]

Re: st: Append and redistribute variables or merge?


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Append and redistribute variables or merge?
Date   Tue, 21 Jan 2014 11:05:40 +0000

You want people to imagine your data and impute the Stata commands you
used. Can you do that from reading the problems of others?

Please

Show concrete examples of your data.

Give the exact commands you used.

Nick
[email protected]


On 21 January 2014 10:58, miriam geringer <[email protected]> wrote:
> Hey guys, I have the following problem.
>
> I have a dataset 1 with the following variables
>
> Name A  Name B  Variable 1 Variable 2 Variable T1
>
> and a dataset 2 with the following variables
>
> Name A  Name B  Variable 1  Variable 2  Variable T2
>
> Basically, some variables of table 1 and table 2 are identical,
> however, there are also some variables that differ.
>
> Now, I want to create a merged dataset that looks like
>
> Name A  Name B  Variable1 Variable 2 VariableT1 Variable T2
>
> Even though some variables are the same, there might be cases in which
> I have Name A Name B in dataset 1 that is missing in dataset 2 and
> vice versa.
> So some are equal, then I want to create one "row" in which I have
> Variable T1 and Variable T2. And when there is no counterpart in
> dataset 1 or dataset 2, then I want to have a row with only either
> variable T1 or T2.
>
> So far, I "appended" the dataset 2 to dataset 1, but then I got:
> Name A  Name B  Variable 1 Variable 2 Variable T1
> Name A  Name B  Variable 1  Variable 2  Variable T2
>
> Is the wrong approach? Or can I somehow then modify/redistribute the variables?
> Should I use the merge function instead? Merge based on the identical
> variables?
>
> Thank you!
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index