Statalist


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

RE: st: loop question


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: st: loop question
Date   Mon, 2 Nov 2009 21:09:21 +0100

<>

http://www.stata.com/support/faqs/data/members.html
may contain part of the answer...

HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Sandu Cojocaru
Sent: Montag, 2. November 2009 20:55
To: [email protected]
Subject: Re: st: loop question

Sergiy,

Within each group, i'm trying to calculate for each member i the sum
of differences between Cj and Ci for all Cj that are strictly greater
than Ci.

hope this clarifies my question.

cheers,
sandu

On Mon, Nov 2, 2009 at 3:49 PM, Sergiy Radyakin <[email protected]>
wrote:
> Hi, Sandu
> Can you explain how member_id is relevant here?
> Can you explain line 4? (group=2,member=1)
> Do you mean Cj>Ci or Cj!=Ci?
> Best, Sergiy
>
> On Mon, Nov 2, 2009 at 2:34 PM, Sandu Cojocaru <[email protected]>
wrote:
>> Dear All:
>>
>> I'm having trouble generating a variable that for each member i equals
>> sum(Cj-Ci) over all Cj>Ci where i and j are members of the same group.
>> Here's an example of the data setup - I'm trying to calculate
>> `outcome_var'.
>> For row 1 outcome_var=0, for row 3 = (200-100)+(300-100) = 300...and so
on...
>>
>> group_id       member_id       C           outcome_var
>> 1                  1                     300        0
>> 1                  2                     200        100
>> 1                  3                     100        300
>> 2                  1                     150        50
>> 2                  2                     200        0
>> 2                  3                     100        150
>> 2                  4                     50          300
>> 3                  1 and so on...
>>
>> Any help would be greatly appreciated!
>> sandu
>> *
>> *   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/


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