Statalist


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

Re: st: AW: Logical condition


From   Dmitriy Krichevskiy <[email protected]>
To   [email protected]
Subject   Re: st: AW: Logical condition
Date   Thu, 15 Oct 2009 10:24:57 -0400

Sorry for that last bother, I got it now. Thanks again.

2009/10/15, Dmitriy Krichevskiy <[email protected]>:
> Thanks for your help Martin.
> Unfortunately, I get 'time-series operators not allowed' even though
> the dataset has been declared panel via xtset (I also tried tsset to
> no avail). Thanks again.
>
>
> 2009/10/14, Martin Weiss <[email protected]>:
>>
>> <>
>>
>>
>>
>> *************
>> clear*
>>
>> input byte( id time b1 i1)
>> 1   1     1   3
>> 1   2     1   4
>> 1   3     0   2
>> 2   1     0   5
>> 2   2     1   6
>> 2   3     0   4
>> 3   1     0   2
>> 3   2     1   3
>> 3   3     1   1
>> end
>>
>> compress
>> list, noobs sepby(id) // in 1/20
>>
>> bys id (time):  /*
>> */ gen byte select= b1[1]==0 & b1[2]==1
>>
>> list if select, sepby(id)
>> *************
>>
>>
>>
>> HTH
>> Martin
>>
>> -----Ursprüngliche Nachricht-----
>> Von: [email protected]
>> [mailto:[email protected]] Im Auftrag von Dmitriy
>> Krichevskiy
>> Gesendet: Mittwoch, 14. Oktober 2009 22:10
>> An: statalist
>> Betreff: st: Logical condition
>>
>> Dear Listers,
>>
>> I have a large panel dataset for which I was hoping to analyze a
>> particular subset of agents. More specifically:
>>
>> id time b1 i1
>> 1   1     1   3
>> 1   2     1   4
>> 1   3     0   2
>> 2   1     0   5
>> 2   2     1   6
>> 2   3     0   4
>> 3   1     0   2
>> 3   2     1   3
>> 3   3     1   1
>> I want to select only those agents from above example who have
>> switched their b1 status from 0 to 1 in the first two periods (agents
>> 2 and 3 above). I want to see what happened to their b1 status since
>> then, more specifically I want to see how future change in status of
>> b1 (back to 0) has reflected on other variables (agent 2 here changes
>> back to 0, and he now has a value of 4 in i1 variable whereas he
>> started with i1=5 before his b1 status has changed). Unfortunately
>> every condition I try to set up drops all observations since b1=0 and
>> b1=1 are mutually exclusive even though I am looking at different time
>> periods.
>>
>> I hope the above makes sense; and, as always, thanks for your help.
>> Dmitriy
>> *
>> *   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/
>>
>
>
> --
> Dmitriy Krichevskiy a. b. c. d. e. f. g. h. i. j. k. l. m. n. o. p. q.
> r. s. t. u. v. w. x. y. z.
>


-- 
Dmitriy Krichevskiy a. b. c. d. e. f. g. h. i. j. k. l. m. n. o. p. q.
r. s. t. u. v. w. x. y. z.

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