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

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