Date: Mon, 6 Dec 2004 10:15:02 -0800
Reply-To: Dennis Diskin <diskin@SNET.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dennis Diskin <diskin@SNET.NET>
Subject: Re: Is it possible to have a conditional macro variable inside a
macro
In-Reply-To: <20041206174100.46320.qmail@web54703.mail.yahoo.com>
Content-Type: text/plain; charset=us-ascii
MK,
It's not clear to me what you are trying to do. Is there only one value of rulename in the temp14 dataset? If so, you could extract it via a data _null_ :
DATA _NULL_;
set temp14;
select (rulename);
when ("CPUGT95") call symput("_LABEL","GBL CPU TOTAL UTIL");
when ("QPCPUQS") call symput("_LABEL","CPU QUEUE TOO LONG");
when ("QPCACUS") call symput("_LABEL","CACHE HIT RATE TOO LONG");
otherwise;
end;
run;
Is this what you are trying to accomplish?
Dennis Diskin
m k <odshtml@yahoo.com> wrote:
Hi Dennis
rulename is a variable in the temp14 dataset having three values CPUGT95,QPCPUQS,QPCACUS.
MK
Dennis Diskin <diskin@snet.net> wrote:
m,
The IF is a datastep statement. You are not in a dtatstep. What is rulename?
Regards,
Dennis Diskin
m k <odshtml@YAHOO.COM> wrote:
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.
---------------------------------
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.