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: st: Obtaining descriptive Stats on matched samples Pre & Post
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: st: Obtaining descriptive Stats on matched samples Pre & Post
Date
Mon, 11 Apr 2011 07:59:43 +0100
Suppose your variables include -id time q38- and you -tsset id time-.
Then the individuals who answered at both times are identified by
by id (time) : gen OK = !missing(q38) & !missing(q38[3-_n])
as for the first time _n is 1 and 3 - _n is 2 and for the second time
_n is 2 and 3 - _n is 1.
or by
bysort id : gen nmissing = sum(missing(q38))
by id : replace nmissing = nmissing[_N]
... if nmissing == 0
However, it would seem that you might want information only on
individuals who asked all questions at all times, for which you might
well start off with something more like
egen nmissing = rowmiss(q1-q50)
bysort id : replace nmissing = sum(nmissing)
by id : replace nmissing = nmissing[_N]
... if nmissing == 0
Nick
On Mon, Apr 11, 2011 at 7:02 AM, Clifton Chow
<[email protected]> wrote:
> I have an unabalanced panel dataset from an identical survey given at 2 interview periods. There are 30-50 questions given in the survey and for each question, some individuals answered at Tiime 1 but not at Time 2 and vice-versa. How can I obtain summary statistics on each question that was answered by individuals at both interview periods? In other words, I need to calculate a Pre and Post mean & variance for each survey item in which there was no missing value for that item pre and post for the ssample? For example, Question 38 had N=72/95 who responded in Time 1 and N=57/95 who responded in Time 2, but some of the 57 who responded in Time 2 did not do so in Time 1.
*
* 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/