<>
My proposal was intended to help you avoid -duplicates-, not for the rest of
your problem.
Anyway, the -collapse- solution is by far the most efficient one, so I
recommend you use it and forget about mine...
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Michael
McCulloch
Gesendet: Sonntag, 25. Oktober 2009 23:31
An: [email protected]
Betreff: Re: st: AW: tagging observations where either x or y are true
Thanks Martin, that tags some but not all the duplicates of sampleid.
I'm also seeking to condense the list from this:
sampleid x y
30.1 0 1
34.1 1 0
34.1 0 1
34.3 1 0
to this:
sampleid x y
30.1 0 1
34.1 1 1
34.3 1 0
where sampleid for which x = y ==1 are on one line.
Sorry this escapes me.
Michael
On Oct 25, 2009, at 3:13 PM, Martin Weiss wrote:
>
> <>
>
> Get the tag via
>
> *************
> bys sampleid: gen byte tag=_N>1
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Michael
> McCulloch
> Gesendet: Sonntag, 25. Oktober 2009 23:08
> An: Statalist Statalist
> Betreff: st: tagging observations where either x or y are true
>
> I'd appreciate advice on this problem which although apparently simple
> is somewhat vexing.
> Note that for:
> sample 30.1 only y is true,
> sample 34.3 only x is true,
> but sample 34.1 both x and y are true,
>
> sampleid x y
> 30.1 0 1
> 34.1 1 0
> 34.1 0 1
> 34.3 1 0
>
> What I'd like to achieve is only one entry for 34.1, where both x and
> y ==1.
> I can identify 34.1 with -duplicates-, but can't figure out the next
> step of concatenating observations for that sampleid such that x=y=1.
>
>
> Michael McCulloch
> Pine Street Foundation
> 124 Pine Street
> San Anselmo, CA 94960-2674
> tel: 415-407-1357
> fax: 206-338-2391
> [email protected]
>
>
>
>
>
>
> *
> * 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/
Michael McCulloch
Pine Street Foundation
124 Pine Street
San Anselmo, CA 94960-2674
tel: 415-407-1357
fax: 206-338-2391
[email protected]
*
* 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/