BookmarkSubscribeRSS Feed
ShirleyInChchNZ
Calcite | Level 5

/** Our analysts used to use ECO / Proc Insight to display a graph to detect outliers (comparing previous and current data values). Once the graph was visible, the user would click on outliers and the ID for the point(s) would display and remain displayed. The user would take a screen shot and follow up on the outliers.

We are switching from ECO to EG and this code plots a graph with hover over functionality. But once the user moves the cursor off the outlier point, the info disappears. Ideally it would be more efficient if the user could hover over a point or click on it, and the ID would be written to a file / dataset to reduce transcription error.

Ideas / suggestions welcome

**/

data myClass;
set sashelp.class;
AltText = ' alt=' || quote('Name: ' || put(Name, $10.)  );
run;

goptions reset=all
device=actximg
border;
axis1 label = ('height');
axis2 label = ('weight');

title "Study of Height vs Weight";
footnote1 j=l "Source: T. Lewis & L. R. Taylor";
footnote2 j=l "Introduction to Experimental Ecology";

proc gplot data=myClass;
   plot height*weight /vaxis=axis2 haxis=axis1 html=AltText ;
run;

footnote1; /* this clears footnote1 and footnote2 */
symbol1 interpol=rcclm95
       value=circle
       cv=darkred
       ci=black
       co=blue
       width=2;
   plot height*weight / haxis=45 to 155 by 10
                        vaxis=48 to 78 by 6
                        hminor=1
                        regeqn;
run;
quit;

1 REPLY 1
ShirleyInChchNZ
Calcite | Level 5

I have found something that mostly gets the job done in https://communities.sas.com/message/108580#108580

The code as below

data foo; set sashelp.class;
if height>=67 then outlier_text=trim(left(height));
run;

symbol1 value=dot interpol=none pointlabel=("#outlier_text");

proc gplot data=foo;
plot height*weight;
run;

has been used as a basis for a macro that can be called by different users, to determine outliers. The user can supply a rule, will see two graphs (one with all points, one with 'rule-breakers' labelled), and will get a dataset and/or xlsx  with the outliers for further processing.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 881 views
  • 0 likes
  • 1 in conversation