BookmarkSubscribeRSS Feed
Varun
Calcite | Level 5

Hi All. I and creating a figure. I need to show different color for different reference line with continuous variable values.

4 REPLIES 4
PGStats
Opal | Level 21

Your question is too vague. Please show us the code that you have developped so far.

PG
Rick_SAS
SAS Super FREQ

See if this example is helpful:

 

proc sgplot data=sashelp.class;
scatter x=height y=weight;
refline  75 / axis=Y lineattrs=(color=blue) label;
refline 100 / axis=Y lineattrs=(color=gold) label;
refline 125 / axis=Y lineattrs=(color=red)  label;
run;
Ksharp
Super User

Make different variables for these different reference line .

 

data class;
set sashelp.class;
if _n_ in(6:10) then refline1=height;
if _n_ in(12:16) then refline2=height;
run;


proc sgplot data=class;
scatter x=height y=weight/group=sex;
refline refline1/axis=x lineattrs=graphdata1;
refline refline2/axis=x lineattrs=graphdata2;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1247 views
  • 3 likes
  • 4 in conversation