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

Re: st: a little help


From   "Stephen P. Jenkins" <[email protected]>
To   [email protected]
Subject   Re: st: a little help
Date   Wed, 5 Feb 2003 17:39:01 +0000 (GMT Standard Time)

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index