I want to draw a triangle with label A, B, C and point on it. But it does not output the results.
data triangle;
length function style color $ 8 text $ 5;
retain hsys xsys ysys "3";
output;
function="move"; x=50; y=90; output;
function="draw"; x=90; y=20; size=2; line=0.5;color="cx808080"; output;
function="draw"; x=10; y=20; output;
function="draw"; x=50; y=90; output;
function='label';color='cx808080';x=50;y=90;size=35;position='3';style='calibri';text='A';textweight='normal';
output;
function='point';color='red';x=50;y=90;output;
run;
proc ganno annotate=triangle;
run;
quit;
Next, I am trying to draw a barchart using the data below.
data barchart;
input Category $2 score 3 color $8;
cards;
A 70 cxe35454
B 60 cx67549A
C 130 cx22ebe8
D 40 cx25eb22
E 90 cxe8eb22
;
run;
data barlabel;
length color category Score style $ 8;
title "MinKhee's first bar chart";
axis1 label=none major=none minor=none style=0
value=none;
axis2 label=none;
legend1 label=('Category') frame;
run;
quit;
proc gchart data=barchart;
vbar discrete category freq=score type=count
gaxis=axis1 raxis=axis2
legend=legend1;
run;
quit;
I am pretty slow in annotate, hope can teach me.
Post it at GRAPH forum. Robs is there.
My suggestion would be to look at more modern techniques, using sgplot and Graph Template Language. These replace the old graphing techniques. If you have a look through Sanjay's excellent blog on Graphs, SGPLOT and GTL you will find examples of pretty much anything you can think of, you may need to combine some of the code to get exactly what you want.
What are you using to program? It works fine for me on SAS 9.3 BASE with ODS Listing as my default output.
At least the annotate part does, the graph doesn't but it generates a lot of errors so you can start by debugging those.
AXIS, LEGEND, SYMBOL and PATTERN statements do not belong inside a DATA step.
I'm not sure what your BARLABEL data set is supposed to do, but it would have terminated, with 1 observation with all blank values when encountering the AXIS statement.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.