Data visualization with SAS programming

How can data in graph popup be captured/written to dataset?

Reply
New Contributor
Posts: 3

How can data in graph popup be captured/written to dataset?

/** 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;

New Contributor
Posts: 3

Re: How can data in graph popup be captured/written to dataset?

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.

Post a Question
Discussion Stats
  • 1 reply
  • 307 views
  • 0 likes
  • 1 in conversation