Statalist


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

Re: st: Re: drop command with panel data


From   [email protected]
To   [email protected]
Subject   Re: st: Re: drop command with panel data
Date   25 Apr 2009 12:39:26 +0100

Thank you! You've been very helpful.
Best wishes,

Sara

On Apr 25 2009, Martin Weiss wrote:

<>

Everything rides on your data structure - as always. Let`s pretend you have a long dataset and a dummy indicating the presence of a mortgage at that particular point in time.

***
clear*
set obs 10000
egen float id = seq(), from(1) to(10000) block(8)
egen float time = seq(), from(1) to(8) block(1)
xtset id time

gen byte mortgage =runiform()<0.25

compress
//what does the participation look like?
xtdes

//drop those who do not have a mortgage at any time
bys id:egen anymortgage=max(mortgage)
keep if anymortgage

//what does the participation look like _now_?
xtdes

xttab mortgage
***


HTH
Martin
_______________________
----- Original Message ----- From: <[email protected]>
To: <[email protected]>
Sent: Saturday, April 25, 2009 1:07 PM
Subject: st: drop command with panel data


I have a panel of households observed for 8 years, I would like to know how can I drop households that never had a mortgage (e.g.) during the time span.

Thank you in advance,

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