Statalist


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

Re: st: How to append these two data sets


From   Quang Nguyen <[email protected]>
To   [email protected]
Subject   Re: st: How to append these two data sets
Date   Mon, 13 Apr 2009 05:26:07 -1000

This is a good question Nick. As explained in my first email, _x_ is
like a fixed variable e.g., gender of the individual. Other variables
can be thought as follows:

y: training programs attended; z duration of the traning program
v: wages received in the last two jobs

Many thanks!


On Mon, Apr 13, 2009 at 4:28 AM, Nick Cox <[email protected]> wrote:
> How do you know that x is 4 for id == 1 in Data 1? That is not clear to me.
>
> Nick
> [email protected]
>
> Quang Nguyen
>
> Thanks Nick and Martin. Actually, the question is a bit trickier than
> "append" can handle. The structure of data 1 and 2 are different,
> thus, the append would result in all missing values for the mitsmatch
> variables.  Thus,
>
> append using data2
>
> will result in all missing values for x, y, z in the combined data set.
>
>
> Actually, I would like to have  the combined data as follows:
>
> Combined data:
>
> id     x       y              z                  v
> 1     4       a               7                missing
> 1     4       b               8                missing
> 1     4       c               9                missing
> 1     4     missing     missing            4
> 1     4    missing      missing            2
>
>
>
> Given:
>
> Data 1
> id          v
> 1           4
> 1           2
> 2           6
> 2           7
>  -------------
>
>  Data 2:
> id     x     y           z
> 1     4      a          7
> 1     4      b          8
> 1     4      c          9
> 2     6     a           7
> 2     6     b           8
> 2     6     c           9
>
>
>
>
> On Mon, Apr 13, 2009 at 3:43 AM, Quang Nguyen <[email protected]> wrote:
>> Dear All:
>>
>> Suppose I have the 2 following data set1:
>>
>> Data 1
>> id          v
>> 1           4
>> 1           2
>> 2           6
>> 2           7
>> -------------
>>
>> Data 2:
>> id     x     y           z
>> 1     4      a          7
>> 1     4      b          8
>> 1     4      c          9
>> 2     6     a           7
>> 2     6     b           8
>> 2     6     c           9
>>
>>
>> Note that _x_ is a fixed effect in data 2 as well as the combined data
>> set. Given that,  do you know how I can append data 1 to data 2 so
>> that the combined data set will have infor from both data 1 and 2 and
>> some missing values due to mismatch between v and (y,z). Specifically,
>> the combined data for the first observation looks like the following:
>>
>> Combined data:
>>
>> id     x    y           z          v
>> 1     4     a           7        mis
>> 1     4     b           8        mis
>> 1     4     c           9        mis
>> 1     4   mis       mis      4
>> 1     4   mis       mis      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/
>



-- 
"My father gave me the greatest gift anyone could give another person,
he believed in me." - Jim Valvano

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index