Date: Wed, 31 Jan 2001 08:16:16 -0500 Reply-To: ahutson@BIOSTAT.UFL.EDU Sender: "SAS(r) Discussion" From: Alan Hutson Organization: University of Florida, Dept. of Statistics Subject: Re: Confidence intervals around a median Comments: To: Andrew Dixon Content-Type: multipart/mixed; I attached a program that does quantiles in general. the median is the example given Andrew Dixon wrote: > > Hi all, > How do I get SAS to return a median and put 95% confidence intervals around it? > Cheers, > Andrew > > ************************************** > > Andrew Dixon > Health Statistician > Public Health Unit > Central Coast Health > PO Box 361 > GOSFORD > NSW 2250 > Ph: 0243 494845 > Fax: 0243 494850 options ls=65; data datax; input x @@; cards; 3.5 2.4 2.1 1.3 1.2 2.2 2.6 4.2 ; proc means noprint; var x; output out=size n=n; %macro quantci(quantile, alpha); data interval;set size; p=(n+1)*&quantile; q=(n+1)*(1-&quantile); lower=100*betainv(&alpha/2,p,q); upper=100*betainv(1-&alpha/2,p,q); percent=100*&quantile; call symput('lll',lower); call symput('ppp',percent); call symput('uuu',upper); proc univariate noprint pctldef=4 data=datax; var x; output out=quantile pctlpts=&ppp &lll &uuu pctlpre=p; proc print; title1 "Quantile=&quantile"; title2 "Alpha=&alpha"; title3 "quantile, lower and upper bound"; %mend; %quantci(2/4,.05); /* reference Hutson, A. D. (1999) Calculating Nonparametric Confidence Intervals for Quantiles Using Fractional Order Statistics. {\em Journal of Applied Statistics}, {\bf 26} 343-353. */ 

Back to: Top of message | Previous page | Main SAS-L page