turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- BI
- /
- Enterprise Guide
- /
- Confidence intervals for Proportions

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-25-2014 04:02 AM

Hello, Does Enterprise Guide provide a way to calculate confidence intervals for proportions without having to write your own code? The formula I am referring to is: p +- 1.96*SQRT(p(-1p)/n) If there is no way to write this without code, does anyone have a reference to, or is able to write some code that calculates that nicely? I am also interested to hear how both a point-and-click, and code method deals with non-response. Thank you

Accepted Solutions

Solution

08-26-2014
11:44 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Silvertreetops

08-26-2014 11:44 PM

All Replies

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Silvertreetops

08-25-2014 08:41 AM

Check proc freq;

proc freq data=sashelp.class order=freq; tables sex/binomial(ac wilson exact) alpha=.1; run;

Xia Keshan

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Ksharp

08-25-2014 09:02 AM

If you start with counts, the first example in the documentation

shows how to incorporate them.

As far as missing, how you address it depends on how it occurred. MCAR can generally be ignored, the missing data can be assumed to have equal impact on all groups. In those cases, your effective sample size is the non-missing observations. If the reason for the missing is known (MNAR), then you can incorporate that as a separate category in any statistical test. Alternately, for both MAR and MNAR, you can use PROC MCMC to actually model the process. The MCMC documentation has a good discussion of missingness ( SAS/STAT(R) 13.1 User's Guide ),

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Silvertreetops

08-25-2014 11:34 PM

Hi All again,

Thank you for your replies.

@Ksharp - I am looking for the confidence intervals of frequencies, not just the mean

@Doc@Duke - I couldnt seem to see an example of a confidence interval for frequencies in your links either sorry.

Based on this - http://www2.sas.com/proceedings/sugi25/25/btu/25p069.pdf (p4) I have edit some code of my own to try and acomplish my outcome of confidence intervals for frequencies.

This code attempts to calculate 95% confidence intervals for QE5AM_Recode, with frequency being a sum of the WT variable. I am an amature coder so it is probably very bad code. Also, it still outputs the first table and I dont want it too. Lastly, I have to enter the n value for the confidence interval calculation (in this case the sum of WT) manually. Ideally, this value would be calculted automatically based on the dataset that was entered.

Is anyone able to help make this more elagent?

Kind Regards

*Calculate Weighted Counts from raw dataset;

**PROC** **TABULATE**

DATA=WORK.QUERY_FOR_LABELS_ADDED_0001

OUT = test;

VAR WT;

CLASS QE5AM_Recode / MISSING;

TABLE /* Row Dimension */QE5AM_Recode,

/* Column Dimension */WT*(Sum);

**RUN**;

*Drop unwanted variables;

**DATA** test_ii;

set test;

drop _TYPE_ _PAGE_ _TABLE_ WT_N;

**RUN**;

*Frequency to calculate Percentage;

**proc** **freq** data=test_ii noprint;

weight WT_sum;

tables QE5AM_Recode / nocum out=test_iii;

**run**;

*Add Confidence Intervals to dataset;

**data** test_iv; set test_iii ;

P = PERCENT/**100** ;

*N is manually added;

N = **2539**;

LB = P - ( **1.96***SQRT( P*(**1**-P)/N ) ) ;

* reset lower bound to 0 if <0 ;

IF LB < **0** THEN LB = **0** ;

UB = P + ( **1.96***SQRT( P*(**1**-P)/N ) ) ;

* reset upper bound to 1 if >1 ;

IF UB > **1** Then UB = **1** ;

label p = ’Proportion Cured’

LB = ’Lower Bound’

UB = ’Upper Bound’ ;

**run**;

*Print Results;

**Proc** **Print** data=test_iv;

**run**;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Silvertreetops

08-26-2014 12:20 AM

Have you looked at PROC UNIVARIATE?

It can do confidence intervals like this example: http://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/viewer.htm#procstat_univaria...

Perhaps with a bit of tweaking it can do what you want.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SASKiwi

08-26-2014 09:15 PM

Hello SASKiwi,

The table in your link does look really close to what I'm looking for. The only problem is that instead of producing confidence intervals for the various quantiles, I want it for proportions from a frequency. I tried to change it to do this, but didn't really get anywhere. Are you able to help?

regards,

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Silvertreetops

08-26-2014 09:34 PM

Unfortunately I haven't explored UNIVARIATE enough to give you a better answer.

However there is another example that does frequency counts:

Does this give you enough to at least get your frequencies? If so can you try the other example's options on top?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SASKiwi

08-26-2014 10:36 PM

Thanks again for your efforts SASKiwi - unfortunatly the earlier option for confidence intervals just produces a seperate table with the quantiles. Any more ideas?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Silvertreetops

08-27-2014 03:50 PM

Have a look here at all of the options under confidence intervals.

Solution

08-26-2014
11:44 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Silvertreetops

08-26-2014 11:44 PM

Try proc surveyfreq

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Silvertreetops

08-27-2014 06:16 PM

Thank you all for your help. PROC SURVEYFREQ is what I was after.