BookmarkSubscribeRSS Feed
LWooly
Calcite | Level 5

Unfortunately I recently lost my code for finding outliers using a schematic boxplot. My original code was made by following this article: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_boxplot_sec...

 

So I tried to recreate it, but for some reason I am not getting the outbox summary data. I am using SAS version 9.4, and while I know that article above is for 9.2, I know I used it on this version before.

 

Can someone please look at my code and tell me what I am doing wrong here?

DATA D5CC;
INPUT TRT ICM TE;
DATALINES;
0	77	153
0	21	86
0	91	137
1	28	103
1	46	129
1	72	166
10	41	128
10	57	166
10	37	113
100	72	165
100	115	216
100	106	109
;
Title 'Schematic TE Boxplot';
PROC BOXPLOT data=D5CC;
plot TE*TRT / boxstyle = schematic
outbox = TEschematic;
run;

The datalines section in the code above was shortened. But I will attach the output I am getting from the full dataset - which is only a boxplot.

 

Any help would be greatly appreciated. Thanks.

6 REPLIES 6
ballardw
Super User

Since your question relates to the existence not of the outbox results data set then the LOG from running your would be more helpful than a picture of the resulting graph.

 

When I run your code I get an output data set.

LWooly
Calcite | Level 5

Here is the log:

 

 

22 DATA D5CC;
23 INPUT TRT ICM TE;
24 DATALINES;

NOTE: The data set WORK.D5CC has 145 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds


170 ;
171 Title 'Schematic TE Boxplot';
172 PROC BOXPLOT data=D5CC;
173 plot TE*TRT / boxstyle = schematic
174 outbox = TEschematic;
175 run;

NOTE: Processing beginning for PLOT statement number 1.
NOTE: 9814 bytes written to C:\Users\woold\AppData\Local\Temp\SAS Temporary
Files\_TD10420_DESKTOP-NR18MRL_\boxplot1.png.
NOTE: There were 145 observations read from the data set WORK.D5CC.
NOTE: The data set WORK.TESCHEMATIC has 38 observations and 4 variables.
NOTE: PROCEDURE BOXPLOT used (Total process time):
real time 0.15 seconds
cpu time 0.12 seconds

 

LWooly
Calcite | Level 5

Hmm. Well I have found a fix, though I didn't think this bit of code was needed. I added this code on to the end of the code above:

proc print data = TEschematic;
run;

And bam. Now I have the data. I don't remember having to use proc print before, but at least it is working now.

ballardw
Super User

@LWooly wrote:

Hmm. Well I have found a fix, though I didn't think this bit of code was needed. I added this code on to the end of the code above:

proc print data = TEschematic;
run;

And bam. Now I have the data. I don't remember having to use proc print before, but at least it is working now.


Without you telling us how you previously accessed the result we can't either. Perhaps you clicked on the output file in the Explorer?

Or had a DMS command to open a viewtable of the output?

Or were working in Enterprise Guide that sometimes opens things even when you may not want them?

 

The key piece and why we request things like the log comes from:

NOTE: The data set WORK.TESCHEMATIC has 38 observations and 4 variables.

Which tells us the data set was created and actually has records in it. Why you couldn't "see" them is a separate question.

If you expect results in a data set you should see something like that. Problems would be indicated if no data set is mentioned or it says "0 observations" which would mean the data set was created with no records.

Also if you had the data set open from some previous step you would get something about "unable to replace because <> was in use by ..." or similar.

 

 

LWooly
Calcite | Level 5

@ballardw wrote:

@LWooly wrote:

Hmm. Well I have found a fix, though I didn't think this bit of code was needed. I added this code on to the end of the code above:

proc print data = TEschematic;
run;

And bam. Now I have the data. I don't remember having to use proc print before, but at least it is working now.


Without you telling us how you previously accessed the result we can't either. Perhaps you clicked on the output file in the Explorer?

Or had a DMS command to open a viewtable of the output?

Or were working in Enterprise Guide that sometimes opens things even when you may not want them?

  

 


 

I'm not sure what I did in the past... But thanks for the information on the log. I've not really been trained how to read it.

Rick_SAS
SAS Super FREQ

As others have said, your code is fine, it's just that the data you've provided doe not contain outliers.

You probably used a WHERE clause to subset the output into low and/or high outliers, something like this

 

DATA D5CC;
do TRT = 0, 1, 10, 100;
   do i = 1 to 100;
      TE = rand("T", 2);
      output;
   end;
end;
run;
Title 'Schematic TE Boxplot';
PROC BOXPLOT data=D5CC;
plot TE*TRT / boxstyle = schematic
outbox = TEschematic;
run;

proc print data=TEschematic;
where _TYPE_ contains "LOW" or 
           _TYPE_ contains "HIGH";
run;

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 552 views
  • 0 likes
  • 3 in conversation