BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
JohanK
Calcite | Level 5

I have prepared a dataset for a swimmer plot.
I want to change the color of the symbols for responders (partial response, progression and Complete remission (CR)), and also the symbol and color for 'No response'.
I have included the dataset as an Excel file , txt file as well my code and output

data attrmap;
retain id "status";
  input 
        @1 value $ 1-40
        @42 fillcolor $7.
		@50 color $7.
        @57 markersymbol $4.;
  datalines ;
Complete remission (CR)                  yellow  yellow starfilled 
partial response   						 green   green  starfilled 
progression 							 blue	 blue   starfilled;
run;

proc sgplot data = testfile dattrmap = attrmap; 
  highlow y=usubjid low=low high=high / highcap=highcap HIGHLABEL=USUBJID  type=bar group=cohort fill nooutline
          lineattrs=(color=black) name='cohort' /*nomissinggroup*/ transparency=0.3;
  scatter y=usubjid x=start / markerattrs=(symbol=trianglefilled size=10 /*color=grey*/) name='s' group=status ; 
  scatter y=usubjid x=start / markerattrs=(symbol=starfilled size=14) group=status attrid=status;
  YAXIS LABEL='Subject ID' DISPLAY=(NOTICKS NOVALUES);
  yaxis reverse display=(noticks novalues noline) label='Subjects Received Study Drug' min=1;
  keylegend 'Cohort' / title='Cohort';
  keylegend 'status' 's'  / noborder location=inside position=bottomright across=1;
  run;

SGPlot77.png

It seems I do something wroing with the attrmap and connecting it to the sgplot program.
Can someone help me? Thanks so much!!

1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Amethyst | Level 16

Do you mean like that:

data testfile;
infile cards dlm="|" missover;
input 
Obs START USUBJID : $ 12. Cohort HIGH LOW STATUS : $ 32. YMIN DURABLE HIGHCAP : $ 20.;
cards;
1 |22|101-001|1|57 |1|No response|-15|.|  
2 |61|101-001|1|57 |1|No response|-15|.|  
3 |22|101-002|2|91 |1|No response|-15|.|  
4 |70|101-002|2|91 |1|No response|-15|.|  
5 |98|101-002|2|91 |1|No response|-15|.|  
6 |28|101-003|3|54 |1|No response|-15|.|  
7 |57|101-003|3|54 |1|No response|-15|.|  
8 |50|202-001|3|98 |1|partial response|-15|-2|  
9 |29|101-005|4|50 |1|No response|-15|.|  
10|55|101-005|4|50 |1|No response|-15|.|  
11|28|202-002|4|119|1|progression|-15|-2|FilledArrow 
12|56|202-002|4|119|1|Complete remission (CR)|-15|-2|FilledArrow 
13|26|202-003|4|35 |1|No response|-15|.|  
14|26|301-001|4|77 |1|No response|-15|.|  
15|56|301-001|4|77 |1|No response|-15|.|  
16|91|301-001|4|77 |1|No response|-15|.|  
17|27|501-002|4|22 |1|No response|-15|.|  
18|27|501-003|4|22 |1|No response|-15|.|  
19|40|101-006|5|50 |1|No response|-15|.|FilledArrow 
20|19|102-003|5|15 |1|No response|-15|.|  
21|28|202-004|5|35 |1|No response|-15|.|FilledArrow 
22|22|301-002|5|28 |1|partial response|-15|-2|FilledArrow 
23|31|301-003|5|24 |1|No response|-15|.|FilledArrow 
;
run;

data attrmap;
retain id "status";
infile cards dlm=",";
  input 
        value : $ 32.
        markerfillcolor : $ 7.
		    markercolor :$ 7.
        markersymbol : $ 4.;
datalines ;
Complete remission (CR),yellow,yellow,starfilled 
partial response,green,green,starfilled
progression,blue,blue,starfilled
No response,red,red,starfilled
;
run;

proc sgplot data = testfile dattrmap = attrmap; 
  highlow y=usubjid low=low high=high / highcap=highcap HIGHLABEL=USUBJID  type=bar group=cohort fill nooutline
          lineattrs=(color=black) name='cohort' /*nomissinggroup*/ transparency=0.3;
  scatter y=usubjid x=start / markerattrs=(symbol=trianglefilled size=10 /*color=grey*/) name='s' group=status ; 
  scatter y=usubjid x=start / markerattrs=(symbol=starfilled size=14) group=status attrid=status;
  YAXIS LABEL='Subject ID' DISPLAY=(NOTICKS NOVALUES);
  yaxis reverse display=(noticks novalues noline) label='Subjects Received Study Drug' min=1;
  keylegend 'Cohort' / title='Cohort';
  keylegend 'status' 's'  / noborder location=inside position=bottomright across=1;
run;

yabwon_0-1702479820469.png

 ?

 

Bart

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26
progression 							 blue	 blue   starfilled;

 

Try it with no semi-colon at the end

--
Paige Miller
yabwon
Amethyst | Level 16

Do you mean like that:

data testfile;
infile cards dlm="|" missover;
input 
Obs START USUBJID : $ 12. Cohort HIGH LOW STATUS : $ 32. YMIN DURABLE HIGHCAP : $ 20.;
cards;
1 |22|101-001|1|57 |1|No response|-15|.|  
2 |61|101-001|1|57 |1|No response|-15|.|  
3 |22|101-002|2|91 |1|No response|-15|.|  
4 |70|101-002|2|91 |1|No response|-15|.|  
5 |98|101-002|2|91 |1|No response|-15|.|  
6 |28|101-003|3|54 |1|No response|-15|.|  
7 |57|101-003|3|54 |1|No response|-15|.|  
8 |50|202-001|3|98 |1|partial response|-15|-2|  
9 |29|101-005|4|50 |1|No response|-15|.|  
10|55|101-005|4|50 |1|No response|-15|.|  
11|28|202-002|4|119|1|progression|-15|-2|FilledArrow 
12|56|202-002|4|119|1|Complete remission (CR)|-15|-2|FilledArrow 
13|26|202-003|4|35 |1|No response|-15|.|  
14|26|301-001|4|77 |1|No response|-15|.|  
15|56|301-001|4|77 |1|No response|-15|.|  
16|91|301-001|4|77 |1|No response|-15|.|  
17|27|501-002|4|22 |1|No response|-15|.|  
18|27|501-003|4|22 |1|No response|-15|.|  
19|40|101-006|5|50 |1|No response|-15|.|FilledArrow 
20|19|102-003|5|15 |1|No response|-15|.|  
21|28|202-004|5|35 |1|No response|-15|.|FilledArrow 
22|22|301-002|5|28 |1|partial response|-15|-2|FilledArrow 
23|31|301-003|5|24 |1|No response|-15|.|FilledArrow 
;
run;

data attrmap;
retain id "status";
infile cards dlm=",";
  input 
        value : $ 32.
        markerfillcolor : $ 7.
		    markercolor :$ 7.
        markersymbol : $ 4.;
datalines ;
Complete remission (CR),yellow,yellow,starfilled 
partial response,green,green,starfilled
progression,blue,blue,starfilled
No response,red,red,starfilled
;
run;

proc sgplot data = testfile dattrmap = attrmap; 
  highlow y=usubjid low=low high=high / highcap=highcap HIGHLABEL=USUBJID  type=bar group=cohort fill nooutline
          lineattrs=(color=black) name='cohort' /*nomissinggroup*/ transparency=0.3;
  scatter y=usubjid x=start / markerattrs=(symbol=trianglefilled size=10 /*color=grey*/) name='s' group=status ; 
  scatter y=usubjid x=start / markerattrs=(symbol=starfilled size=14) group=status attrid=status;
  YAXIS LABEL='Subject ID' DISPLAY=(NOTICKS NOVALUES);
  yaxis reverse display=(noticks novalues noline) label='Subjects Received Study Drug' min=1;
  keylegend 'Cohort' / title='Cohort';
  keylegend 'status' 's'  / noborder location=inside position=bottomright across=1;
run;

yabwon_0-1702479820469.png

 ?

 

Bart

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



JohanK
Calcite | Level 5

Thank you so much Bart!!

 

I overlooked this.. And also I noticed my attrmap variables were named wrong. Markerfillcolor and markercolor instead of what I used fillcolor and color. Thanks so much!

yabwon
Amethyst | Level 16

Glad I could help 🙂 

There is a "gazilion" of those options. easy to skip some of them.

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



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
  • 2217 views
  • 0 likes
  • 3 in conversation