Date: Mon, 8 Jan 2007 11:31:26 -0500 "Richard A. DeVenezia" "SAS(r) Discussion" "Richard A. DeVenezia" Re: finding the (x,y) coordinates of the max/min of an ellipse To: sas-l@uga.edu

Michael Friendly wrote: > Hi all, > > I have a set of macros that draw what I call HE plots, showing the > variation due to hypothesis and due to error in a multivariate linear > model by ellipses. See my recent article in Journal of Statistical > Software, > http://www.jstatsoft.org/v17/i06/ > > I want to write a label for each ellipse at the (x,y) coordinate of > either the maximum or minimum value of y and the corresponding x > value. I can do this as shown below using proc summary, but this > solution is inconvenient in the macros because > (a) it requires an ID variable and > (b) requires an extra pass through the ellipses > data set. > > Perhaps there is a simpler (SQL ?) solution someone can > suggest?

Definitely a SQL worthy query.

---------- data ellipse; input id x y function \$; mat = 1; output; mat = 2; output; datalines; 1 0.99993 0.01222 move 2 0.79459 1.18537 draw 3 0.28576 1.90575 draw 4 -0.33223 1.89820 draw 5 -0.82332 1.16560 draw 6 -0.99993 -0.01222 draw 7 -0.79459 -1.18537 draw 8 -0.28576 -1.90575 draw 9 0.33223 -1.89820 draw 10 0.82332 -1.16560 draw 11 0.99993 0.01222 draw ;

proc sql; create view bounds as select * , y=min(y) as isMinY , y=max(y) as isMaxY from ellipse group by mat having y=max(y) or y=min(y); ----------

Richard A. DeVenezia http://www.devenezia.com/

Back to: Top of message | Previous page | Main SAS-L page