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

st: RE: a "byable" cii


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: a "byable" cii
Date   Thu, 6 Feb 2003 20:11:33 -0000

VISINTAINER PAUL
> 
> I was recently asked to compute confidence intervals for 
> several proportions
> (more than 100).  The data came in a spreadsheet in two 
> columns: numerator
> (num) and denominator (den).  I thought I could quickly run 
> them using
> either ci or cii.  However, it appears that ci doesn't read 
> summary data and
> cii is not "byable".  Despite my best efforts, I couldn't 
> devise a program
> that would read more than the first line of the data.  
> 
> My very inelegant solution to the problem was this:  I 
> converted the two
> columns of data into a single row of data with 200 columns: 
>  (e.g., num1
> num2 . . . num100 den1 den2 . . . den100).
> 
> Then I ran the following program:
> 
> 	forvalues x=1/100 {
> 	  cii den`x' num`x'
> 	}
> 
> While it worked, it was really cumbersome converting the 
> data.  I suspect
> (hope) there is an easier way to do this.  Any suggestions?

forval i = 1/100 { 
	local n = num[`i'] 
	local d = den[`i'] 
	cii `d' `n' 
} 

Nick 
[email protected] 
*
*   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