I specified datalabel option in my proc , still it's not showing up. How can I show data labels?
In see this message in my log..
WARNING: SASUSER.TEMPLAT is not a template store! It will be ignored.
WARNING: The bar labels are suppressed. Use BARLABELFITPOLICY=NONE to force the labels to be displayed.
proc sgplot data=all_reads PCTLEVEL=GRAPH;
styleattrs datacolors=(Red Blue) datacontrastcolors=(Red Blue);
vbarbasic Sample_name /transparency=.4 response = Total_Mean group=Replicate groupdisplay = cluster datalabel
nooutline Clusterwidth=0.8
stat=mean dataskin=gloss name='bar';
highlow x=Sample_name low=Low high=High / LINEATTRS=(COLOR=BLACK) group=replicate groupdisplay=cluster highcap=serif lowcap=serif ;
xaxis display=(nolabel noticks) discreteorder=data;
yaxis label="% Total Reads" ;
keylegend 'bar' /title='' noborder autooutline;
run;
For this case, you might want to pre-summarize the data and use a VBARPARM to render the bars and limits. In the simple example below, I had PROC SUMMARY compute the upper and lower CLM just to create data to demonstrate drawing the limits. All you need in your case the mean calculation:
proc summary data=sashelp.class nway;
class age;
var weight;
output out=calced mean=mean uclm=upper lclm=lower;
run;
proc sgplot data=calced;
vbarparm category=age response=mean / limitupper=upper limitlower=lower;
run;
Please do not copy error and warning messages separate from the code in the log. Position is important relative to code. Copy the text from the log including the procedure code and all the notes, warnings and messages. On the forum open a text box using the </> icon above the main message window and paste the text. The text box is important and the message windows on this forum will reformat text and may move diagnostic information that SAS often supplies as part of the log.
Your first "warning" is most likely to occur with PROC Template. You don't show any such and so can't discuss that.
NOTE: Analytical products: SAS/STAT 15.2 SAS/ETS 15.2 SAS/OR 15.2 SAS/IML 15.2 SAS/QC 15.2 NOTE: Additional host information: X64_10PRO WIN 10.0.19041 Workstation NOTE: SAS initialization used: real time 2.84 seconds cpu time 2.43 seconds NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead. NOTE: All profile changes will be lost at the end of the session. WARNING: SASUSER.TEMPLAT is not a template store! It will be ignored. NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead. NOTE: All profile changes will be lost at the end of the session.
Also my Standard deviation bars are not showing up in the center..
Does not show any code from Proc SGPLOT or the messages.
That about SASUSER.Profile is typical when you have two (or more) active display manager sessions running. If that is the case then close the extras.
53 54 title1 " Percent Total Read "; 55 ods listing style=listing gpath="c:\temp\Graphs\"; 56 57 ods graphics / width=8in height=2.81in; 58 ods graphics / reset=ALL outputfmt=PNG imagename="Total_Read_Mean_std"; 59 60 61 62 proc sgplot data=all_reads PCTLEVEL=GRAPH; 63 styleattrs datacolors=(Red Blue) datacontrastcolors=(Red Blue); 64 vbarbasic Sample_name /transparency=.4 response = Total_Read_Mean group=Replicate groupdisplay = cluster 64 ! datalabel 65 nooutline Clusterwidth=0.8 Barwidth=1 66 stat=mean dataskin=gloss name='bar'; 67 highlow x=Sample_name low=Low high=High / LINEATTRS=(COLOR=BLACK) group=replicate groupdisplay=cluster 67 ! highcap=serif lowcap=serif ; 68 xaxis display=(nolabel noticks) discreteorder=data; 69 yaxis label="% Total Reads" ; 70 keylegend 'bar' /title='' noborder autooutline; 71 run; NOTE: Writing HTML Body file: sashtml.htm WARNING: SASUSER.TEMPLAT is not a template store! It will be ignored. NOTE: PROCEDURE SGPLOT used (Total process time): real time 9.77 seconds cpu time 3.61 seconds WARNING: The bar labels are suppressed. Use BARLABELFITPOLICY=NONE to force the labels to be displayed. WARNING: The bar labels are suppressed. Use BARLABELFITPOLICY=NONE to force the labels to be displayed. NOTE: Listing image output written to c:\temp\Graphs\Total_Read_Mean_std.png. NOTE: There were 96 observations read from the data set WORK.ALL_READS.
For this case, you might want to pre-summarize the data and use a VBARPARM to render the bars and limits. In the simple example below, I had PROC SUMMARY compute the upper and lower CLM just to create data to demonstrate drawing the limits. All you need in your case the mean calculation:
proc summary data=sashelp.class nway;
class age;
var weight;
output out=calced mean=mean uclm=upper lclm=lower;
run;
proc sgplot data=calced;
vbarparm category=age response=mean / limitupper=upper limitlower=lower;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.