Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
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
<clifton_chow@post.harvard.edu> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index