Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: consecutive variables


From   "Sergio Correia" <[email protected]>
To   [email protected]
Subject   Re: st: consecutive variables
Date   Wed, 20 Dec 2006 13:43:35 -0500

You could use a mix of -generate- and _n in order to achieve what you want.

However, I would think it could be better (considering that you are
studying cohorts) to use the -tsfill- command, which fills missing
observations in a panel.

See help tsfill, and remember that you must first -tsset- your data.

After using tsfill, count the number of missing values. If there are 0
missing values, then there are no gaps.


On 12/20/06, Manasi Vydyanath <[email protected]> wrote:
Hello - I was wondering whether there was any command for checking
for gaps in a given variable. In other words - supposing I have
"myvar" which is supposed to run from 1 to 256 consecutively. But
there may be gaps in this variable, and it might be missing, say, 69
and 78. Is there a command I can use to detect this sort of thing?

In case anyone is interested, a fuller context of the problem is that
I am creating synthetic cohorts from a series of random cross
sections, and one of the conditions is that there must be no empty
cohort. I wrote a do-file that takes my time-invariant parameters
(age, race and gender) and partitions the set of individuals across
each year. One of the conditions I would like to impose is that there
should be no empty partition, and I was wondering whether there might
be an easy way to check this condtion.)

Thanks!

Mnaasi
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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