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;
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
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;
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.