Hi there, Is there a way to separate my graph into 4 quadrants like in the picture? I'd want the lines to go through the 50 mark on both axis.
Thank you
See if this gets you started. Feel free to ask
data have;
do x=1 to 100;
y=rand('integer', 0, 100);
output;
end;
run;
data plot;
set have;
if x <= 50 & y <= 50 then group=1;
else if x > 50 & y <= 50 then group=2;
else if x <= 50 & y > 50 then group=3;
else if x > 50 & y > 50 then group=4;
run;
proc sgplot data=plot noautolegend;
scatter x=x y=y / group=group markerattrs=(symbol=circlefilled size=10) colorresponse=group colormodel=(blue gold red green);
refline 50 / axis=x lineattrs=(thickness=2 color=black);
refline 50 / axis=y lineattrs=(thickness=2 color=black);
run;
Result:
See if this gets you started. Feel free to ask
data have;
do x=1 to 100;
y=rand('integer', 0, 100);
output;
end;
run;
data plot;
set have;
if x <= 50 & y <= 50 then group=1;
else if x > 50 & y <= 50 then group=2;
else if x <= 50 & y > 50 then group=3;
else if x > 50 & y > 50 then group=4;
run;
proc sgplot data=plot noautolegend;
scatter x=x y=y / group=group markerattrs=(symbol=circlefilled size=10) colorresponse=group colormodel=(blue gold red green);
refline 50 / axis=x lineattrs=(thickness=2 color=black);
refline 50 / axis=y lineattrs=(thickness=2 color=black);
run;
Result:
thank you this is perfect!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.