Hi! I want to draw a bar chart using fully customized annotate, using axis order 2, only the data area. The chart must drawn without using proc gchart.
Here is the data:
A 70 cxe35454
B 60 cx67549A
C 130 cx22ebe8
D 40 cx25eb22
E 90 cxe8eb22
And here is the results that I want:
length function color $8 text $30;
retain xsys ysys '2' hsys '3' ;
function='label';x=40;y=90;text="MinKhee's first bar chart";position='5';color='CX808080';style='calibri';size=3;
font= 'calibri' color=CX808080 height=45pt "MinKhee's first bar chart ";
proc ganno annotate=yoyo;
Hope you all understand what I meant
Sorry, no its not clear. I do not understand why you are restricted to using one procedure, use the right tool for the job. From my side I would recommend that you look to using sgplot or graph template language. These are the newest technology for creating graphical outputs and are more powerful and easy to use than previous installments. If you need help on them Sanjay has an excellent blog showing examples:
I think you are looking for the annotate macros:
%annomac; /* before your data set to make the macros available*/
and use %bar to draw the bars and %label to create the labels but your X Y coordinates need to be in the data or you need to provide the logic to assign them. Maybe additional variable retained and incremented by you for x.
Note that the annotate macros may update internal variables named XLAST, YLAST, XLSTT, YLSTT that help keep track of the current drawing position.
To use xsys & ysys = '2', I think you need to have an actual chart, so that you have an axis for your coordinates to be inside.
In your case, I'd just use xsys & ysys = '3', and use Proc Gslide (I always use that for a 'blank' page, instead of Proc Ganno - just my personal preference).
When I change to the following ...
retain xsys '3' ysys '3' hsys '3' ;
proc gslide anno=yoyo;
I get your custom-drawn bar chart as follows:
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.