DATA Step, Macro, Functions and more

SAS Graph and Proc Print output

Reply
Contributor
Posts: 39

SAS Graph and Proc Print output

I have the following graph:

 

lines.JPG

 

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?

 

data work.wr_wp_combined_ELG;

set work.wr_wp_combined_ELG end=end;

by carnum;

if _n_=1 then do;

lx=0;

ly=0;

lj=0;

lk=0.4;

end;

if end then do;

lx=3;

ly=3;

lj=3;

lk=3.4;

end;

run;

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;

run;

title;

 

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";

run;

title;

Super User
Posts: 10,549

Re: SAS Graph and Proc Print output

[ Edited ]

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);

Ask a Question
Discussion stats
  • 1 reply
  • 180 views
  • 0 likes
  • 2 in conversation