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: Panel data: control if variable changes over time, for a given individual


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Panel data: control if variable changes over time, for a given individual
Date   Thu, 4 Jul 2013 10:04:33 +0100

This is an FAQ. See

How do I list observations in a group that differ on a variable?
http://www.stata.com/support/faqs/data-management/listing-observations-in-group/

bysort id (mobirth) : gen different = mobirth[1] != mobirth[_N]
l id mobirth if different

The logic is that sorting month of birth within blocks for each
identifier will shake different month values apart. There is much more
in the FAQ.

Nick
[email protected]


On 4 July 2013 09:39, Giacomo PALLARO <[email protected]> wrote:
> Dear Statalist,
> I'm quite new to Stata and I have problems with a panel dataset for which I can't find a trivial solution (that I'm sure it exists).
> My unbalanced panel dataset contains an individual identifier, id (I've more than 150.000 obs so I can't do the job by hand), a wave identifier (from 1 to 4) and other variables among which mobirth (the month of birth of the interviewed individual).
> mobirth is collected in each wave the individual participates but it happens that the guy gives different answers in different waves and I would like to check if this happens, so to be able to correct the data.
> Unfortunately I don't know yet how to tell Stata to fix an individual and control if the mobirth is the same in all the waves the individual is present (recalling that an individual may not be present in all the waves, like the examples below).
>
>        id            wave    mobirth
> 1140231201      1           2
> 1140231201      2           2
> 1140231201      3           3
> 1140231201      4           2
>
> 1140234253      2           5
> 1140234253      3           6
> 1140234253      4           6
>
> 1140232586      1           3
> 1140232586      2           4
>
>
> Any answers would be greatly appreciated as I am really stuck!
> Thank you!
> Giacomo Pallaro
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index