BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
mariko5797
Pyrite | Level 9

I need to find the difference of proportions between two treatment groups and obtain their 95% CI via Clopper-Pearson methodology.

Is there a way to use a SAS procedure, such as PROC FREQ, to obtain the 95% CI or do I need to manually calculate?

 

The following code is what I've tried to use to obtain CI, but none are being outputted.

data have;
 label trt= 'Treatment' 
 	   param= 'Parameter'
 	   response= 'Response 1=success 2=fail'
	   x= 'Counts'
	   n= 'Total'
	   ;
 input trt param response x n @@;
 cards;
 	1	1	1	9	13
	1	2	1	13	13
	1	3	1	6	13
	1	1	2	4	13
	1	2	2	0	13
	1	3	2	7	13
 	2	1	1	17	18
	2	2	1	12	18
	2	3	1	14	18
	2	1	2	1	18
	2	2	2	6	18
	2	3	2	4	18
	;
proc sort; by param;
proc freq noprint;
 by param;
 tables trt*response / riskdiff binomial(CL= clopperpearson) out= dsnout1;
 weight x;
 output binomial n out= dsnout2;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

What kind of proportions are you refering to ?

If you mean x/n , then check this:

http://support.sas.com/kb/24/188.html

 

If you mean Response=1 's ratio(the number of Response=1/ the number of each treat group), check PROC FREQ's relrisk:

proc sort; by param;
proc freq ;
 by param;
 tables trt*response / riskdiff(column=1 CL=exact) ;
 weight x;
 output out= dsnout2 riskdiff;
run;

Ksharp_0-1699091256064.png

 

View solution in original post

2 REPLIES 2
ballardw
Super User

When you use NOPRINT then you told the procedure not print the output for anything. The OUTPUT statement would need to include options related to relative risks if Rel1, Rel2, Riskdiff, Riskdiff1, Riskdiff2, etc, Look at the online help under output, there's about a dozen related.

 

Or don't use NOprint and do use the ODS output to capture the entire Riskdiff output:

ods output RiskDiffCol1= RisksColumn1
           RiskDiffCol2= riskscolumn2
;

proc freq data=have;
 by param;
 tables trt*response / riskdiff binomial(CL= clopperpearson) out= dsnout1;
 weight x;
 output binomial n out= dsnout2;
run;
Ksharp
Super User

What kind of proportions are you refering to ?

If you mean x/n , then check this:

http://support.sas.com/kb/24/188.html

 

If you mean Response=1 's ratio(the number of Response=1/ the number of each treat group), check PROC FREQ's relrisk:

proc sort; by param;
proc freq ;
 by param;
 tables trt*response / riskdiff(column=1 CL=exact) ;
 weight x;
 output out= dsnout2 riskdiff;
run;

Ksharp_0-1699091256064.png

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 864 views
  • 0 likes
  • 3 in conversation