Statalist


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

st: What is sttocc criteria when only one control meets matching definition?


From   "Diego Bassani" <diego.bassani@gmail.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   st: What is sttocc criteria when only one control meets matching definition?
Date   Wed, 3 Oct 2007 10:33:55 -0400

Dear list members,

I am using sttocc to sample the controls (4 per case) for a nested
case-control study. Controls are matched to cases by region and age
(in complete years). I have a pool of 600,000 possible controls and
12,000 cases. I have been observing that when less than four controls
are available, 1,2, or 3 controls are selected. Nevertheless, I was
reading the program for sttocc and wondered if in situations where
only one control is available it would be selected and matched to the
case or not.

The statement (if r(N)<`number' {) in the sttocc.ado file triggered my
doubt. PLease see last part of the program below.

program define RSamp
	version 6
	syntax varname [if] [, GENerate(string) Number(integer 1) ]
	tokenize `varlist'

	local id `1'
	tempvar u include
	confirm new var `generate'
	qui {
		qui gen `generate'=0
		qui count `if' `in'
		
if r(N)<`number' {
			noi di in bl /*

			*/ " Warning: sample requested greater" /*

			*/ " than population. Only " r(N) " controls selected"

			replace `generate' = 1 `if' `in'
			exit
		}
		qui gen `u'=uniform() `if' `in'

		sort `u'
		qui replace `generate'=1 in 1/`number'
		sort `id'
	}
end



from: http://www.stata.com/updates/ado/sttocc.ado

Thanks to all,

Diego



-- 
Diego G. Bassani, M.Sc., Ph.D.
Epidemiologist - Child Health & Development
Centre for Global Health Research
St Michael's Hospital, University of Toronto
70 Richmond Street East, Suite 202A - Toronto, ON - M5C 1N8, Canada
Tel: +1 416 864 6060 ext. 3357  |  Fax: +1 416 964 5256
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index