BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data have;
call streaminit(123);
do type='A','B','C','D';
  do group='A','B','C','D';
    do obs=1 to 20;
      x=rand('normal');
	  y=rand('normal');
      output;
	end;
  end;
end;
run;

data dattrmap;
id='id';
input value $ linecolor $ LINEPATTERN $ LINETHICKNESS   MARKERCOLOR $ MARKERSYMBOL :$20.;
cards;
A red  solid  4  red circlefilled
B orange  dot 6  orange triangleFilled
C yellow  dash 8 yellow starfilled
D green   longdash 10  green  DiamondFilled
;

proc sgpanel data=have dattrmap=dattrmap;
panelby type/novarname ;
reg x=x y=y /group=group markerattrs=(size=12) attrid=id; 
run;

Ksharp_0-1705393256927.png

 

View solution in original post

3 REPLIES 3
emaneman
Pyrite | Level 9

hello. 

 

I am plotting regressions in SGPANEL:


proc sgpanel data=dataset ;
panelby type ;
reg x=IV y=DV /group=group ;

 

The variable group has four levels (A B C D), and thus i get four separate regression lines. 

I would like to control the the color (red, orange, yellow, green), line type (solid, dot, dash, longdash) and line thickness as well as the type of markers for the observed values and their color (matching the colors of the corresponding line, of course).

I am having a really hard time making that work.

If you have any suggestion, I'd very much appreciate.  

Ideally a solution that would work also with SGPANEL.

I used SAS Studio.

 

Best,

 

Eman

 

 

 

 

Ksharp
Super User
data have;
call streaminit(123);
do type='A','B','C','D';
  do group='A','B','C','D';
    do obs=1 to 20;
      x=rand('normal');
	  y=rand('normal');
      output;
	end;
  end;
end;
run;

data dattrmap;
id='id';
input value $ linecolor $ LINEPATTERN $ LINETHICKNESS   MARKERCOLOR $ MARKERSYMBOL :$20.;
cards;
A red  solid  4  red circlefilled
B orange  dot 6  orange triangleFilled
C yellow  dash 8 yellow starfilled
D green   longdash 10  green  DiamondFilled
;

proc sgpanel data=have dattrmap=dattrmap;
panelby type/novarname ;
reg x=x y=y /group=group markerattrs=(size=12) attrid=id; 
run;

Ksharp_0-1705393256927.png

 

emaneman
Pyrite | Level 9

hello,

thanks for the reply, and sorry for the late response on my end.

I wanted to have only one group/regression line in each quadrant, so I adjusted the syntax, and it works well!

Thank you 

Emanuele

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 3 replies
  • 1430 views
  • 3 likes
  • 2 in conversation