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: How to generate a vector of the lagged reduction rate the tenant faces, which is different from the current reduction rate?
From
Yuval Arbel <[email protected]>
To
[email protected]
Subject
Re: st: How to generate a vector of the lagged reduction rate the tenant faces, which is different from the current reduction rate?
Date
Tue, 14 Aug 2012 22:08:55 +0300
Many thanks Nick. I ran the following commands:
by appt: gen ref2=reduct_per[_n-1] if reduct_per!=reduct_per[_n-1]
by appt: replace ref2=ref2[_n-1] if ref2==.
by appt: replace ref2=reduct_per if ref2==.
by appt: replace ref2=0 if time_index==0
and it worked wonderfully!!!
On Tue, Aug 14, 2012 at 5:00 PM, Nick Cox <[email protected]> wrote:
> See for precisely this problem:
>
> Cox, N.J. 2011. Stata tip 101: Previous but different. Stata Journal
> 11(3): 472-473.
>
> The heart of the matter is covered in
>
> http://www.stata.com/statalist/archive/2011-01/msg00999.html
>
> Nick
>
> On Tue, Aug 14, 2012 at 1:46 PM, Yuval Arbel <[email protected]> wrote:
>
>> I appreciate very much your assistance in the following question
>> (which might save me a lot of time in my research).
>>
>> I have an unbalanced panel of public-housing tenants. They are offered
>> the option to purchase their rental units and face different reduction
>> rates from the full apartment price.
>>
>> Below I provide an example of three tenants (appt ==2851 | appt==2862
>> | appt==2906),
>>
>> My question refers to the reduction rate column. I would like to
>> generate a new variable, which reflects the last reduction rate the
>> tenant faces, which is different from the current one (or equal to the
>> current one in the case that this is the first reduction rate the
>> tenant faces).
>>
>> For tenant 2906 (for example) the numerical value of this variable
>> should be 58.98 for periods 0-4, 59.38 for periods 5-7, 57.89 for
>> periods 8-10 etc.
>>
>> I would like to thank you in advance for your assistance
>>
>> Yuval
>>
>> list appt time_index reduct_per fail if appt ==2851 | appt==2862 | appt==2906
>>
>> +-----------------------------------+
>> | appt time_i~x reduct~r fail |
>> |-----------------------------------|
>> 1. | 2851 0 75 0 |
>> 2. | 2851 1 75 0 |
>> 3. | 2851 2 75 0 |
>> 4. | 2851 3 75 0 |
>> 5. | 2851 4 75 0 |
>> |-----------------------------------|
>
> <snip>
> *
> * 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/
--
Dr. Yuval Arbel
School of Business
Carmel Academic Center
4 Shaar Palmer Street,
Haifa 33031, Israel
e-mail1: [email protected]
e-mail2: [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/