## Testing ratio different from benchmark // proportional test

Solved
Super Contributor
Posts: 506

# Testing ratio different from benchmark // proportional test

[ Edited ]

Hi Everyone,

In my data, each row is a experiment with number of (YES), number of (NO) and a benchmark ratio.

Each row, I want to perform a test to see if the actual Yes/No ratio significantly greater than the benchmark ratio (with confident interval of 7%). I want to export the test result out.

Thank you,

HHCFX

data have;
input id yes no benchmark_ratio;
datalines;
1 90 10 0.52 55 40 0.73 50000 40000 0.5;
run;

data have; set have;
actual_ratio=yes/(yes+no);run;

data have; set have;
z=(actual_ratio-benchmark_ratio)/(benchmark_ratio*(1-benchmark_ratio)/(yes+no))**0.5;
p=1-cdf('normal',z,0,1);
if p<0.05 and z>0 then significantly_higher=1;
if p>0.95 and z<0 then significantly_lower=1;run;

https://onlinecourses.science.psu.edu/statprogram/node/164

https://communities.sas.com/t5/Base-SAS-Programming/standard-normal-probability-density-and-cumulati...

data a;
x=pdf('normal',1.644853627,0,1);
y=1-cdf('normal',1.644853627,0,1);run;

``````
data have; input id yes no benchmark_ratio;datalines;1 90 10 0.52 55 40 0.73 50000 40000 0.5;run;data have; set have;actual_ratio=yes/(yes+no);run;data have; set have;z=(actual_ratio-benchmark_ratio)/(benchmark_ratio*(1-benchmark_ratio)/(yes+no))**0.5;p=1-cdf('normal',z,0,1);if p<0.05 and z>0 then significantly_higher=1;if p>0.95 and z<0 then significantly_lower=1;run;https://onlinecourses.science.psu.edu/statprogram/node/164 https://communities.sas.com/t5/Base-SAS-Programming/standard-normal-probability-density-and-cumulative-functions/td-p/15540data a;x=pdf('normal',1.644853627,0,1);y=1-cdf('normal',1.644853627,0,1);run;``````

Accepted Solutions
Solution
‎02-23-2018 07:22 AM
Super User
Posts: 10,784

## Re: Testing ratio different from benchmark

Change your data structure and do Z-Test or Chi-Square Test in @Rick_SAS    blog:

https://blogs.sas.com/content/iml/2017/07/05/test-equality-two-proportions-sas.html

All Replies
Solution
‎02-23-2018 07:22 AM
Super User
Posts: 10,784

## Re: Testing ratio different from benchmark

Change your data structure and do Z-Test or Chi-Square Test in @Rick_SAS    blog:

https://blogs.sas.com/content/iml/2017/07/05/test-equality-two-proportions-sas.html

Super Contributor
Posts: 506

## Re: Testing ratio different from benchmark

Thanks a lot.

HHCFX

☑ This topic is solved.