PROC boxplot DATA = Costing ;
plot IDC*?;
RUN;
Hello
I want to create a boxplot to identify outliers in my data
What would I specify as the unit in the plot statement?
Switch to SGPLOT
proc sgplot data=costing;
vbox IDC;
run;
I would call upon @Reeza , @PaigeMiller for best advice possible
@Ranjeeta wrote:
PROC boxplot DATA = Costing ;
plot IDC*?;
RUN;
Hello
I want to create a boxplot to identify outliers in my data
What would I specify as the unit in the plot statement?
proc univariate data=costing plots;
var idc;
run;
The PLOTS option causes a boxplot to be generated.
Hello @Ranjeeta,
@Ranjeeta wrote:
PROC boxplot DATA = Costing ;
plot IDC*?;
(...)What would I specify as the unit in the plot statement?
You mean the group variable. I think you would need to create a new variable with an arbitrary constant value in all observations (if there is no such variable in dataset Costing). This may be numeric or character (but not missing) and you could create it "on the fly" in a view:
data _tmp / view=_tmp;
set costing;
retain _c 0;
run;
proc boxplot data=_tmp;
plot IDC*_c / boxstyle=schematic;
run;
Note that by default (BOXSTYLE=SKELETAL) outliers would not be identified with a special symbol.
The alternative solutions that have been suggested are easier to use: You don't need a group variable and the "schematic" plot style is the default.
With PROC UNIVARIATE the box plot comes in a panel together with other plots, which may or may not be convenient. The VBOX statement of PROC SGPLOT and the PLOT statement of PROC BOXPLOT are (in recent SAS releases) more flexible in terms of outlier definition: see options WHISKERPCT= and WHISKERPERCENTILE=, respectively. Note that in addition to exploratory analyses using these definitions or the default (that is: values outside the lower and upper fences) there exist many statistical tests for specific situations (e.g. tests for a lower and upper outlier-pair in a normal sample with unknown parameters, see statistical literature such as Barnett/Lewis).
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.