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 (December 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 6 Dec 2004 09:21:08 -0800
Reply-To:     m k <odshtml@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Comments:     DomainKeys? See http://antispam.yahoo.com/domainkeys
From:         m k <odshtml@YAHOO.COM>
Subject:      Is it possible to have a conditional macro variable inside a macro
Comments: To: Nathaniel_Wooding@dom.com
In-Reply-To:  <OF7BD71A83.5CB0BDA0-ON85256F60.004B7945@dom.com>
Content-Type: text/plain; charset=us-ascii

Nat

I tried using these statements in the graphs generating macro, but with lot of errors.

******************************************************************** if rulename="CPUGT95" then %LET _LABEL="GBL CPU TOTAL UTIL"; if rulename="QPCPUQS" then %LET _LABEL="CPU QUEUE TOO LONG"; if rulename="QPCACUS" then %LET _LABEL="CACHE HIT RATE TOO LONG"; ********************************************************************

I am wondering if I am doing it the right way. I mean, assigning conditional labels. My graph macro is below.

*************************************************************** %macro graph_each; options nofmterr; %do i=1 %to 2; title; GOPTIONS xpixels=0 ypixels=0 device=ActiveX; SYMBOL1 INTERPOL=spline HEIGHT=1 VALUE=STAR CV=BLUE LINE=1 WIDTH=3; Axis1 STYLE=1 WIDTH=1 MINOR=NONE LABEL=(FONT='Microsoft Sans Serif' HEIGHT=12pt JUSTIFY=Right); Axis2 STYLE=1 WIDTH=1 MINOR=NONE LABEL=(FONT='Microsoft Sans Serif' HEIGHT=12pt JUSTIFY=Center); if rulename="CPUGT95" then %LET _LABEL="GBL CPU TOTAL UTIL"; if rulename="QPCPUQS" then %LET _LABEL="CPU QUEUE TOO LONG"; if rulename="QPCACUS" then %LET _LABEL="CACHE HIT RATE TOO LONG"; ods html file="c:\sas\new\graph&i..html"; PROC GPLOT DATA = temp14; where &i=_i; PLOT YAXIS * DATETIME / VAXIS=AXIS1 HAXIS=AXIS2 FRAME; LABEL YAXIS = &_LABEL; RUN; QUIT; ods html close; %end; %mend graph_each; %graph_each; *****************************************************************************************************

Nathaniel_Wooding@dom.com wrote: MK

I am writing from home and don't have documentation handy.

The general solution is to simply add a label statement to you plot statement

PROC GPLOT DATA = temp14; where &i=_i; PLOT YAXIS * DATETIME / VAXIS=AXIS1 HAXIS=AXIS2 FRAME;

label yaxis = "GLB CPU TOTAL UTIL";

RUN; QUIT;etc

however, your use of a variable that takes on various values makes this more difficult. You have a couple of options

1) enclose your plot stuff in a macro and include the variable name that you want to plot as a macro variable. 2) restructure your data so that you have a plot variable such as yaxis that includes the proper values for each rulename (this may be necessary in option 1 above) and use a by statement to plot each value of rulename.

Without haveing a better idea of exactly what your are doing and having had only two cups of coffee so far this morning, this is probably my best answer.

One important note: you will probably want to have your labels print vertically instead of the default horizontal scheme. In your axis statement, you will need to add angle and rotate statements to specify the proper orientation of your text.

If you go to the SAS web site www.sas.com you will find on-line documention. If you go to the SAS/Graph section and look up the axis statement, you should find the answer as well as examples.

Nat Wooding

--------------------------------- Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. Learn more.


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