Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Dummy variable transformation replacing missing data


From   Joe Dreyfus <[email protected]>
To   <[email protected]>
Subject   Re: st: Dummy variable transformation replacing missing data
Date   Mon, 11 Jun 2012 18:22:06 +0200

I'm almost there. Nick is correct in anticipating that the result of -egen
xcount = count(x), by(id)- is more than one. The program suggested leads
to conflicts in the new variables where two different indicators are
switched on at different time periods.

Is it possible to modify the command so the when an indicator is switched
on (for example at t = 2), then it transformed to be switched on for all
time periods, sorted by individual? I think this will avoid conflict
described above.

Cheers,
Joe



On 11/06/12 5:10 PM, "Nick Cox" <[email protected]> wrote:

>That's a very good FAQ but it's not quite what Joe is asking for.
>
>Joe wants something like this:
>
>egen x1 = max(x), by(id)
>
>except to that to be safe this should only be used if the result of
>
>egen xcount = count(x), by(id)
>
>is at most one. 
>
>Nick 
>[email protected]
>
>Ronnie Babigumira
>
>This might be helpful
>
>http://www.stata.com/support/faqs/data/missing.html
>
>On Monday, June 11, 2012 at 2:54 PM, Joe Dreyfus wrote:
>
> 
>> I have the following data.
>> 
><snip>  
>> 
>> 
>> The time period where the indicator is on is not relevant. I just need
>>to know how to transform the variable so that if it is swtiched on in
>>one time period it is transformed to be switched on for all time
>>periods. 
>> 
>
>*
>*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index