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

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
Onyx | Level 15

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



Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 18 replies
  • 1309 views
  • 2 likes
  • 2 in conversation