05-05-2016 01:17 PM
I have the following graph:
i want only the data points that are above and below those two lines (arrows shown to indicate).
i want to be able to use proc print to show these data points that fall above or below those lines.
i am having a hard time figuring out how to do this. i have defined the lines in the data set, and then defined them in sgplot so they show up on the graph. is there any way i can take the 'slope' of the line and apply it to a where statement in proc print so i get only those values above/below the lines?
set work.wr_wp_combined_ELG end=end;
if _n_=1 then do;
if end then do;
title1 "Barber S2-C";
title2 "B-Truck Wedge Rise vs Max Column Wear Depth";
proc sgplot data=work.wr_wp_combined_ELG noautolegend;
scatter x=wp_max_b y=WR_truck_B / datalabel=carnum datalabelattrs=(size=10) MARKERATTRS=(SIZE=2);
series x=lx y=ly / lineattrs=(color=red) ;
series x=lj y=lk / lineattrs=(color=red);
xaxis values=(0 to 3 by .2) label="Maximum Wear Depth" grid;
yaxis values=(0 to 3 by .2) label="Avg Wedge Rise" grid;
proc print data=work.wr_wp_combined_ELG noobs;
var carnum inspection_date wp_max_b WR_truck_B;
******some sort of where statement here???***********
title "All Car Numbers. Might need to do a manual analysis of those that fit criteria";
05-05-2016 03:25 PM - edited 05-05-2016 03:27 PM
The generic form would be:
Where y-value < (lower bound) or y-value > (upper bound);
lower bound and upper bound would be expressed as a function of the X variable, the ever populat mx + b with m the slope b the intersept.
where WR_truck_B < (m*wp_max_b +lowerb) or WR_truck_B >(m*wp_max_b + upperb);