BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
serrld113
Obsidian | Level 7

test.png

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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:

 

 

SGPlot19.png

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

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:

 

 

SGPlot19.png

serrld113
Obsidian | Level 7

thank you this is perfect!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1581 views
  • 0 likes
  • 2 in conversation