LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 29 Oct 2008 19:38:23 -0400
Reply-To:   Ya Huang <ya.huang@AMYLIN.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ya Huang <ya.huang@AMYLIN.COM>
Subject:   Re: Annotate facility, to place a line in the middle of 2 data points on Gchart and Gplot and ...
Comments:   To: rdb1956@HOTMAIL.COM

For Q1, you can change x to a numeric var then use format to show the character, this way, the vertical line can be done easily with vref=...

For Q2, I don't know if there is any workaround, therefore, has to go annotation route..

data test; set test; if groupstr = 'a' then ngrp=1; else if groupstr = 'b' then ngrp=2; else if groupstr = 'c' then ngrp=3; else if groupstr = 'd' then ngrp=4; else if groupstr = 'e' then ngrp=5; else if groupstr = 'f' then ngrp=6; run;

proc format; value grp 1='a' 2='b' 3='c' 4='d' 5='e' 6='f'; run;

goptions reset=all;

axis1 order=(0 to 7 by 1); axis2 minor=none; proc gplot data=test; plot errcnt*ngrp / vaxis=axis1 haxis=axis2 href=1.5 2.5 3.5 4.5 5.5; format ngrp grp.; symbol1 line=1 value=dot interpol=join; run; quit;

data anno; set test; length function $8; retain xsys '2' ysys '1' when 'A'; function='move'; y=0; xc=groupstr; midpoint=groupstr; output; function='draw'; y=100; xc=groupstr; midpoint=groupstr; output; keep function xsys ysys y xc midpoint when; run;

proc gchart data=test; vbar groupstr / type=sum sumvar=errcnt discrete noframe annotate=anno; run; quit;

On Wed, 29 Oct 2008 17:55:32 -0500, Red Eagle <rdb1956@HOTMAIL.COM> wrote:

>Question 1. >How do I create the annotate dataset such that the data values in the 'test' >dataset below will determine the location of a vertical line placed exactly in >the middle of "groupstr" values, and running to the top of the frame, or if >possible running up to meet the frame on the graph? Just code to get a vertical >line in the middle of 'groupstr' values 'c' and 'd' would be fantastic. The >sample code below produces a simple line graph, to help with the answer, I >hope. The vertical axis is "errcnt" values and on the horizontal axis is >"groupstr" values. > >data test; > errcnt = 5; groupstr = 'a'; output; > errcnt = 3; groupstr = 'b'; output; > errcnt = 6; groupstr = 'c'; output; > errcnt = 4; groupstr = 'd'; output; > errcnt = 2; groupstr = 'e'; output; > errcnt = 3; groupstr = 'f'; output; >run; > >axis1 order=(0 to 7 by 1); >proc gplot data=test; > plot errcnt*groupstr / vaxis=axis1; > symbol1 line=1 value=dot interpol=join; >run; >quit; > > >Question 2. >Code below produces a simple bar chart. Again on the horizontal axis is the >variable "groupstr". As above I would like to place a line running vertically >in the middle of the "groupstr" value bars "c" and "d". Again the data would >need to drive the location so more data rows or changes in available space do >not prevent correct positioning of the line. The line would run to the top of >the frame in this chart. > >The use of %SYSTEM , %LINE macro's etc. in the answer is fine. > > >proc gchart data=test; > vbar groupstr / type=sum sumvar=errcnt discrete noframe; >run; >quit; > > >Question 3. >Is it possible to use the annotate facility to place text around the output >from a template containing several graphs? If so how? >I'll need a title and labels on the side. > > >Thank-you in advance!!

Back to: Top of message | Previous page | Main SAS-L page