| Date: | Thu, 12 Jun 2003 18:39:20 +0100 |
| Reply-To: | peter@CRAWFORDSOFTWARE.DEMON.CO.UK |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Peter Crawford <peter@CRAWFORDSOFTWARE.DEMON.CO.UK> |
| Subject: | Help with Macro Variables |
|
| Content-Type: | text/plain |
Date: Thu, 12 Jun 2003 17:18:18 GMT
Hi all,
I am trying to evaluate a couple of macro variables. One of the macro
variables has been read in using a call symput (TestPct), the other has been
stated within the code (DesiredTestPct):
%let DesiredTestPct=90;
call symput('TestPct',Percent);
I have tried two different ways of evaluating the expression TestPct minus
DesiredTestPct, but neither seems to do the job:
%let Delta=&TestPct-&DesiredTestPct;
%let Delta2=%eval(&TestPct-&DesiredTestPct);
%put &Delta1;
%put &Delta2;
Which gives me:
201 %let Delta1=&TestPct-&DesiredTestPct;
202 %let Delta2=%eval(&TestPct-&DesiredTestPct);
ERROR: A character operand was found in the %EVAL function or %IF condition
where a numeric
operand is required. The condition was: 89.265033408-90
203
204 %put &Delta1;
89.265033408-90
205 %put &Delta2;
Can anyone explain how I should be calling them?
Thanks in advance
Mark
Because %eval() supports only integers
try %sysevalf() instead , like
%let Delta2=%sysevalf(&TestPct-&DesiredTestPct);
Good Luck
Peter Crawford
available for SAS consultancy contracts
|