Hello,
I need to find outliers using the Interquartile Range(IQR) but first I have to count first and the third quartile. How can I achieve this in easly way? Also I want to group my calculation. Let's say I have example data like below:
data HAVE;
input FRUIT $ COUNT;
datalines;
Apple 2
Apple 5
Apple 7
Apple 9
Apple 19
Banana 1
Banana 3
Banana 3
Banana 5
Banana 8
;
What I've done is:
PROC MEANS data=HAVE q1 q3 ;
BY FRUIT;
VAR COUNT;
RUN;
But what I got is a proc means report, I need results in table to refer to them further like:
data WANT;
input FRUIT $ Q1 Q3;
datalines;
Apple 5 9
Banana 3 5
;
I've found solution myself. It's possible to add output function to proc means procedure.
PROC MEANS data=HAVE;
BY FRUIT;
VAR COUNT;
output out=FRUIT_CALC Q1= Q3= /autoname;
RUN;
A few pointers to help you get an answer faster
The description of what you want might be obvious to you, but it is unclear to me (and probably others)
Thanks
I've found solution myself. It's possible to add output function to proc means procedure.
PROC MEANS data=HAVE;
BY FRUIT;
VAR COUNT;
output out=FRUIT_CALC Q1= Q3= /autoname;
RUN;
You could get " Interquartile Range(IQR) " directly.
proc summary data=sashelp.heart nway;
class status;
VAR height;
output out=FRUIT_CALC qrange= /autoname;
RUN;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.