NewbieCode
NewbieCode

Reputation: 21

What percent of scores are in a range via SAS?

I have a sample dataset below that shows scores and their resulting pass/fail. It's been quite a long time since i've had to do any statistical analysis, but can someone help me figure out via SAS what percent of my data falls into a range of scores grouped by the pass variable?

Expected output could be something like: 1% of pass=1 scores are between the score ranges of 504-560. Or something to just show the percent of observations in each range.

Score Pass_Fail_Result
405 0
410 0
430 0
520 1
550 0
630 0
710 1
720 1

Upvotes: 0

Views: 69

Answers (1)

Reeza
Reeza

Reputation: 21274

Assuming you want to bin your scores in some way, you first need to define those bins. You can use PROC FORMAT for that. Then calculate the average of the pass_fail_result which is the percent of success.

proc format;
value score_fmt
low - 500 = 'Less than 500'
500 - 600 = '500 to 600'
600 - high = '600+';
run;

proc means data=have noprint nway;
class score;
format score score_fmt.;
var pass_fail_result;
output out=want mean=pct_success;
run;

proc print data=want;
var score pct_success;
format pct_success percent12.1;
run;

Upvotes: 1

Related Questions