BookmarkSubscribeRSS Feed
MinKhee
Calcite | Level 5

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.

4 REPLIES 4
Ksharp
Super User

Post it at GRAPH forum. Robs is there.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

http://blogs.sas.com/content/graphicallyspeaking/

Reeza
Super User

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.

ballardw
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 631 views
  • 0 likes
  • 5 in conversation