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

ok, now I don't understand what do you mean by "why does the data label not show anymore?" - there are data labels ( "XX (YY%)" ) on the plot, what other data label do you expect ?

 

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



Anita_n
Pyrite | Level 9

In sgplot there are datalabel and a seglabel statements,  the seglabels label the segements, that is what we did.  The datalabel labels the totals per bar, like bar 1 will have a total of 226 placed at the top of the bar. That is what I mean

yabwon
Amethyst | Level 16

I think this should be it:

data have4;
set have3;
by period visit;
if first.visit then tot=0;
pos= tot + SumDosis/2;
tot + SumDosis;

if last.visit then /* this is to avoid ugly warnings in the log */ 
  do;
    total=tot;
    vst=visit;
  end;

length N_percentage $15 ;
N_Percentage=catx(" ", SumDosis, "(", put(percentage, percent8.2), ")");
keep period drug visit SumDosis N_percentage pos total vst;
run;


ods graphics / width=1200px height=1000px;
proc sgpanel data = have4;

  styleattrs datacolors=(
CXfc8d59
CXfdbb84
CXfdd49e
CXfee8c8
CXfff7ec
CXffffff
CXfff7fb
CXece7f2
CXd0d1e6
CXa6bddb
CX74a9cf
);

  panelby period / columns=3 novarname noborder;

  vbarparm category=vst response=total / datalabel=total seglabel
  OUTLINE OUTLINEATTRS=(color=black THICKNESS=1) NOFILL 
  ;
  vbarparm  category=visit response=SumDosis / group=drug grouporder=data  groupdisplay=stack
  DATASKIN=NONE OUTLINE OUTLINEATTRS=(color=black THICKNESS=1) FILL 
  ;
  text x=visit y=pos text=N_Percentage / group=drug TEXTATTRS=(Color=black Family="Arial" Size=6 Weight=bold);
run;

 

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
  • 18 replies
  • 4281 views
  • 2 likes
  • 2 in conversation