Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: a little help


From   "Brendan Cushing-Daniels" <[email protected]>
To   <[email protected]>
Subject   Re: st: a little help
Date   Wed, 05 Feb 2003 12:50:51 -0500

I think Steven's suggestion might not catch every HH with someone
covered by public insurance (suppose the first person in the HH is not
covered by public insurance, but the second person is, for example).  If
SS1inHH is an indicator of how many people in the HH are covered by
public insurance, as it appears to be from the original posting, then
the following modification to Steven's code may work:

bysort HH: ge tag = (_n==1)   /* or use -egen- tag function */
count SS1inHH if (tag==1 & SS1inHH>=1).

Brendan



>>> [email protected] 02/05/03 12:39PM >>>
On Wed, 5 Feb 2003 11:23:27 -0600 Rodrigo Brice�o 
<[email protected]> wrote:

> Dear stata user friends:
> 
> I need to calculate how many households have at less one member
insured with
> the public sector. I calculated a number if the household have at
less a
> member insured. But I don't know how to calculate the number of
households
> that have one or more members insured. For example:
> 
> HH   SS1 SS1inHH
> 1       .       1
> 1       .       1
> 1       1      1
> 1       .       1
> 2       1      2
> 2       2      2
> 3       .       0
> 3       .       0
> 
> How can I calculate that only 2 households have at least one member
insured?

If I understand you correctly you have calculated the vble you want 
(SS1inHH), but have repeated observations per household (idvar = HH).

Why not tag one observation per household and then do the count you 
want selecting the tagged obs?  Something like the following:

bysort HH: ge tag = (_n==1)   /* or use -egen- tag function */
count SS1inHH if tag



Stephen
----------------------
Professor Stephen P. Jenkins <[email protected]>
Institute for Social and Economic Research (ISER)
University of Essex, Colchester, CO4 3SQ, UK
Tel: +44 (0)1206 873374. Fax: +44 (0)1206 873151.
http://www.iser.essex.ac.uk 

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