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

Hi All,

 

I am trying to generate a figure plot using the below code. I am getting the output as in the attached screen shot.


proc sgpanel data=have  ;
panelby SUBJID / layout=PANEL novarname columns=4 rows=2;
series x=x_axis_var y=aval /group=trt01p_ attrid=myid lineattrs=(pattern=mediumdash thickness=2);
scatter x=x_axis_var y=aval /group=trt01p_ attrid=myid markerattrs = (symbol=circlefilled size=8);

rowaxis integer grid values=(0,50,75,100) label="test";
colaxis integer grid values=(1 to 10 by 1) discreteorder=data label="Day";

run;
quit;

 

My query is how can we change the Blue color plots 'Green', Red color plots to 'Blue' and the bottom Legend with Green and Blue colors?

csa_1-1624381705014.png

 

 

Thanks.

1 ACCEPTED SOLUTION
3 REPLIES 3
ChrisNZ
Tourmaline | Level 20
FreelanceReinh
Jade | Level 19

Hi @csa,

 

Compared to the other thread, you inserted the attrid=myid option into the SERIES and SCATTER statements. However, without using the DATTRMAP= option in the SGPANEL statement there's nothing that "myid" refers to. So, in addition to this option you need an attribute map dataset, as described in Example: Create a Panel That Uses an Attribute Map:

data attrmap;
retain ID "myid";
input value markercolor $ linecolor $;
datalines;
1 green green
2 blue  blue
;

proc sgpanel data=have dattrmap=attrmap;
...

Note that most likely you will need to adapt the values of variable value above to your data, unless your variable trt01p_ happens to be numeric with values 1 and 2 (for the groups currently displayed in blue and red, respectively) and not formatted. If trt01p_ is character with values, say, "Active" and "Placebo" or formatted with these format labels, define value as a character variable (of sufficient length) in the DATA step above and replace 1 and 2 by Active and Placebo, resp., in the data lines.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 1093 views
  • 6 likes
  • 4 in conversation