BookmarkSubscribeRSS Feed
🔒 This topic is locked. We are no longer accepting replies to this topic. Need further help? Please sign in and ask a new question.
dkosovsky
Calcite | Level 5

Hello all! 

would very much appreciate your help with SGPLOT and HIGHCAP statement.

I have monthly usage data for 2 patients:

data usage;
   infile datalines ;
   input  ptid:$8. Usage:$10. month:32. year:32. start:32. end:32. highcap:$20. idname $8.;
 datalines;
 1 >=75% 8 2018 0 1 null 1
 1 >=75% 9 2018 1 2 null blank
 1 >=75% 10 2018 2 3 null blank
 1 >=75% 11 2018 3 4 null blank
 1 >=75% 12 2018 4 5 null blank
 2 >=75% 7 2018 0 9 FilledArrow 2
 2 >=75% 8 2018 1 9 FilledArrow blank
 2 >=75% 9 2018 2 9 FilledArrow blank
 2 >=75% 10 2018 3 9 FilledArrow blank
 2 >=75% 11 2018 4 9 FilledArrow blank
 2 50%-75% 12 2018 5 9 FilledArrow blank
 2 50%-75% 1 2019 6 9 FilledArrow blank
 2 >=75% 2 2019 7 9 FilledArrow blank
 2 >=75% 3 2019 8 9 FilledArrow blank
 
;
 
data usage;
set usage;
if highcap='null' then highcap='';
if idname='blank' then idname='';
 
run;

 

I created a horizontal plot using SGPLOT, with colors marking the usage categories (red=low, orange=medium/low, yellow=medium, green=high) and I would like an arrow to mark the ongoing patient. 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) discreteorder=data;

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

 

but in output it seems like the arrow is at the beginning of the line, not at the end of it.

dkosovsky_0-1687431344146.png

 

any thoughts about why is this happening and how to fix it?

any advice would be highly appreciated!

1 REPLY 1
SASJedi
SAS Super FREQ

This is an exact duplicate of you other post. I'm going to lock this one and leave the other open so that the answers will all be in one place. https://communities.sas.com/t5/SAS-Programming/Arrow-in-not-at-the-end-of-the-bar-with-SPGLOT-and-HI...

Check out my Jedi SAS Tricks for SAS Users

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
  • 1 reply
  • 147 views
  • 0 likes
  • 2 in conversation