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]

Re: st: RE: Subset of data into new file


From   Steven Archambault <archstevej@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Subset of data into new file
Date   Fri, 20 Aug 2010 11:56:15 -0600

In my example, the Group name repeats. The second dataset has more
group members than the first. I want to assign every group member the
average value in the larger data set.  I don't think the regular merge
command will work, unless I am not thinking about it correctly. What
would be merged? The group name? Those are not unique.

Does this make sense?

Thanks,
Steve





On Fri, Aug 20, 2010 at 11:15 AM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>
> <>
> As you say, -merge- the two files. Which "repeats" are you referring to?
>
>
> HTH
> Martin
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Steven
> Archambault
> Sent: Freitag, 20. August 2010 19:01
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Subset of data into new file
>
> Hi all,
>
> I have data about groups, from which I am calculating means for the groups.
>
> Indiv Group Size GroupAvgSize
> 1        a          2           4
> 2        a          4           4
> 3        a          6           4
> 1        b          3           3
> 2        b          4           3
> 3        b          2           3
>
>
> Then, I want to merge the group avg size with a larger set of data
> containing the same groups, but a larger set of individuals (where
> size is not recorded).
>
> Indv    Group
> 1           a
> 2           a
> 3           a
> 4           a
> 5           a
> 1           b
> 2           b
> 3           b
> 4           b
> 5           b
>
> Is there a way to do this without exporting the data with GroupAvgSize
> to a spreadsheet, where I could crop out the repeats?
>
> Thanks!
>
> -Steve
> *
> *   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/
>

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