BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sagarg
Fluorite | Level 6

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;

 

Sagarg_0-1620379963008.png

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

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;

 

 

View solution in original post

2 REPLIES 2
BrunoMueller
SAS Super FREQ

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;

 

 

GraphGuy
Meteorite | Level 14

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;

 

star_bar.png

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 1107 views
  • 3 likes
  • 3 in conversation