BookmarkSubscribeRSS Feed
dkosovsky
Calcite | Level 5

Hello everyone,

would very much appreciate your assisstance with SGPLOT using HIGHCAP.

I have monthly usage data for 2 patients:

 

data usage ;
 infile datalines;
   input ptid:$10. usage:$12. month year start end highcap:$20. idname:$10.;
   datalines;
2 >=75% 8 2018 0 9 FilledArrow 2
2 >=75% 9 2018 1 8 FilledArrow blank
2 >=75% 10 2018 2 8 FilledArrow blank
2 >=75% 11 2018 3 8 FilledArrow blank
2 50%-75% 12 2018 4 8 FilledArrow blank
2 50%-75% 1 2019 5 8 FilledArrow blank
2 >=75% 2 2019 6 8 FilledArrow blank
2 >=75% 3 2019 7 8 FilledArrow blank
1 >=75% 4 2018 0 1 null 1
1 >=75% 5 2018 1 2 null blank
1 >=75% 6 2018 2 3 null blank
1 >=75% 7 2018 3 4 null blank
1 50%-75% 8 2018 4 5 null blank
 
;
data usage;
set usage;
if highcap='null' then highcap='';
if idname='blank' then idname='';
run;
 
I'm creating a horizontal bar plot per patient over time (months), annotating each usage category with color (low=red, medium/low=orange, medium=yellow and high=green). I want the ongoing patient to be flagged with arrow. I use the following code:


proc sgplot data=usage dattrmap=attrmap ;
highlow y=Ptid low=start high=end / type=bar group=Usage
lineattrs=(color=black pattern=solid) barwidth=1
lowlabel=idname highcap=highcap attrid=Usage_Rang labelattrs=(color=black size=8) ;
keylegend / title='Usage' valueattrs=(size=8pt) titleattrs=(size=8pt);
scatter y=Ptid x=start / markerattrs=(size=0) ;
xaxis grid label = 'Treatment duration (Months)' offsetmax=0.02 values=(0 to 36 by 3);
yaxis grid display=(noticks novalues nolabel) ;

footnote1 j=c HEIGHT=10pt FONT='Arial' '"Arrow-heads" denote Patient On Therapy';
run;

 

but it seems like the arrow is being placed in the patient's first month, not last:

dkosovsky_0-1687437359709.png

 

any thoughts about how to adjust the code so that the arrow will appear at month 8?

your help will be very much appreciated!

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 0 replies
  • 464 views
  • 0 likes
  • 1 in conversation