Pyrite | Level 9

## Calculate Median, P10 and P90 in CAS

Hi, i have a 19 million row table for which I need to find the Median, P10 and P90 using several class/groupBy. The table is in CAS. In 9.4 this can easily be done with proc means. From the documentation I see that the percentile methods is not supported in Cas. Moving the table to The Spree server is really slow. I can't find anywhere in the documentation how I can do this in CAS. I tried Fedsql but that do not work?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
SAS Super FREQ

## Re: Calculate Median, P10 and P90 in CAS

I would use PROC CAS to call the percentile action directly:

``````cas;   /* connect to CAS server */

proc casutil;
load data=Sashelp.Cars casout='Cars' replace; /* use active caslib */
quit;

proc cas;
percentile.percentile /
table={name="Cars",
vars={"Cylinders", "MPG_City", "Weight"},
groupby={"Origin"}
}
values={10, 50, 90}    /* specify percentiles */
method = "Iterative"   /* faster than "exact" methods */
;
run;``````
2 REPLIES 2
SAS Super FREQ

## Re: Calculate Median, P10 and P90 in CAS

I would use PROC CAS to call the percentile action directly:

``````cas;   /* connect to CAS server */

proc casutil;
load data=Sashelp.Cars casout='Cars' replace; /* use active caslib */
quit;

proc cas;
percentile.percentile /
table={name="Cars",
vars={"Cylinders", "MPG_City", "Weight"},
groupby={"Origin"}
}
values={10, 50, 90}    /* specify percentiles */
method = "Iterative"   /* faster than "exact" methods */
;
run;``````
Pyrite | Level 9

## Re: Calculate Median, P10 and P90 in CAS

Thanks a lot
Discussion stats
• 2 replies
• 935 views
• 0 likes
• 2 in conversation