I used function quantile in R to do the calculation of 90th, 75th, 50th, 25th percentile, but then my colleague used SAS proc univariate to do the same calculation, we got quite different results (for example, 90th percentile from R is 47.36, but 90th percentile from SAS is 50.64). I'm trying to figure out why. Could anybody give me some guidance on this?
R code:
quantile(c(43.55,41.30,39.40,40.93,38.74,39.97,45.38,41.48,45.01,42.03,44.71,43.42,45.83,43.44,37.84,50.64,53.16,45.95), prob=c(0.90, 0.10, 0.75, 0.50, 0.25))
SAS code:
data x;
input x;
datalines;
43.55
41.30
39.40
40.93
38.74
39.97
45.38
41.48
45.01
42.03
44.71
43.42
45.83
43.44
37.84
50.64
53.16
45.95
;
run;
proc univariate data=x noprint ;
var x;
output out=new p90=p90 p10=p10 q3=p75 median=p50 q1=p25 ;
run;