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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 750 views
  • 3 likes
  • 2 in conversation