I am having simple Bar plot. See below code. In SCORE dataset for name "LMN" doesn't have any marks. I want to present star(*) at the x-axis below tickvalues (I can hide tickvalues).
Any thoughts How to present Star(*) at axis, indicating it is different from dataset row having no values.
data score;
input name $1-3 marks 5.;
datalines;
abc 50
bcd 70
LMN
kgh 90
uyt 10
;
run;
proc template;
define statgraph temp;
begingraph;
layout overlay;
barchart x=name y=score;
endlayout;
endgraph;
end;
run;
proc sgrender data=score template=temp;
run;
You can use the XAXISTABLE statement for this. Why not simply use Proc SGPLOT for the graph. See example below
data score;
infile cards dlm="," dsd missover;
input name $ marks ;
if missing(marks) then do;
marker = "*";
end;
datalines;
ABC,50
BCD,
LMN,
KGH,90
UYT,10
;
proc sgplot data=score tmplout="c:\temp\sgplot2gtl.sas";
vbarbasic name / response=marks;
xaxistable marker / nolabel location=inside valueattrs=(size=15pt color=red) ;
xaxistable marker / nolabel location=outside valueattrs=(size=15pt color=red) ;
run;
You can use the XAXISTABLE statement for this. Why not simply use Proc SGPLOT for the graph. See example below
data score;
infile cards dlm="," dsd missover;
input name $ marks ;
if missing(marks) then do;
marker = "*";
end;
datalines;
ABC,50
BCD,
LMN,
KGH,90
UYT,10
;
proc sgplot data=score tmplout="c:\temp\sgplot2gtl.sas";
vbarbasic name / response=marks;
xaxistable marker / nolabel location=inside valueattrs=(size=15pt color=red) ;
xaxistable marker / nolabel location=outside valueattrs=(size=15pt color=red) ;
run;
Another way would be to annotate the * character:
data score;
input name $1-3 marks 5.;
datalines;
abc 50
bcd 70
LMN
kgh 90
uyt 10
;
run;
data score_anno; set score (where=(marks=.));
length label $300 anchor x1space y1space function textcolor $50;
layer='front';
x1space='datavalue'; xc1=name;
y1space='graphpercent'; y1=7;
function='text'; label='*';
textcolor='gray55'; textsize=15;
width=100; widthunit='percent'; anchor='center';
run;
proc sgplot data=score pad=(bottom=10pct) sganno=score_anno;
vbarparm category=name response=marks;
xaxis display=(nolabel);
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.