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

st: RE: repeating cc command on a series of genotypes


From   Lee Sieswerda <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: repeating cc command on a series of genotypes
Date   Mon, 9 Sep 2002 12:34:00 -0400

Basic looping is quite straightforward and there are many ways to do it. See
-for-, -forvalues-, -foreach-, and -while-. You could try this:

forvalues n = 1/# {
	cc tox_x gene_`n'
}
where # = the number of genes and x equals the "particular toxicity" you
refer to. This particular bit of code only works if the gene numbers are
contiguous. If there are gaps, you'll have to specify the numlist
differently (see -forvalues-) or try -foreach- instead.
Either one will give you copious ouput to sift through.
If you are only interested in a particular parameter, like the odds ratio
for example, rather than the whole output table of -cc-, you could try:

*******
tempname memhold
tempfile results

postfile `memhold' gene or ub lb using `results'

forvalues n = 1/# {
	quietly cc tox_x gene_`n'
	post `memhold' `n' r(or) r(ub_or) r(lb_or)
}
postclose `memhold'
******
This would give you a new dataset containing all the ORs with their CIs,
thus saving you the trouble of sifting through all of the output manually.
Alternatively, you could use -logistic- to get the ORs and then use either
-outreg- or the -parmest- package to collect the output.
If you want to get fancy you could get the OR for every combination of both
x and n by nesting two -forvalues- or -foreach- loops.

Best,

Lee Sieswerda

Lee Sieswerda, Epidemiologist
Thunder Bay District Health Unit
999 Balmoral Street
Thunder Bay, Ontario
Canada  P7B 6E7
Tel: +1 (807) 625-5957
Fax: +1 (807) 623-2369
[email protected]
www.tbdhu.com



> -----Original Message-----
> From:	Richard Aplenc [SMTP:[email protected]]
> Sent:	Monday, September 09, 2002 11:13 AM
> To:	[email protected]
> Subject:	st: repeating cc command on a series of genotypes
> 
> I am analyzing a case control study of genotypes and drug toxicity.  I
> would like to test the association between a series of genotypes (gene_1,
> gene_2..gene_n) coded 0/1 with a series of toxicitites (tox_1,
> tox_2,..tox_n) also coded 0/1.
> 
> While I can do this with a series of "cc tox_x gene_x" commands in my do
> file, I would like to loop through all the genotypes for a particular
> toxicity.  However, I can't figure out the appropriate commands for that.
> 
> Thank you for your help.
> 
> Richard
> Richard Aplenc, MD
> Pediatric Oncology
> Center for Clinical Epidemiology and Biostatistics
> Children's Hospital of Philadelphia
> 4th Floor Wood Building
> 34th and Civic Center Blvd.
> Philadelphia, PA 19104
> 215-590-2801
> 215-590-4183 (fax)
> *
> *   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