Date: Fri, 17 Apr 2009 12:37:19 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: do while
In-Reply-To: A<66935f0f-7438-4357-8b79-ce8db625b60c@w9g2000yqa.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
Hi hd,
The syntax you have works fine,
as you can see after trying the
sample code below. Are you sure
you just didn't have the expected
values for the two variables
being evaluated? (also, don't
forget to provide some code or
logic to make sure both variables
eventually get set to values that
will fail the evaluation so that
the looping will terminate and
not keep running as an endless
loop forever.)
%macro test(all1and2,temp);
%put START;
%do %while ((&all1and2 = 1) or (&temp>=6));
%put AAAAA all1and2 is >&all1and2<;
%let all1and2=2; %* force terminate loop ;
%let temp=2; %* force terminate loop ;
%put BBBBB all1and2 is >&all1and2<;
%end;
%put END;
%mend;
%test(1,0); * works ;
%test(0,0); * works ;
%test(0,7); * works ;
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst
Investment Management & Research
Russell Investments
253-439-2367
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of hd
Sent: Friday, April 17, 2009 12:26 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: do while
Hello,
I am having trouble in the syntax for do while in macros
is this correct
%do %while ((&all1and2 = 1) or (&temp>=6));
when i just omit the second condition it works.
%do %while (&all1and2 = 1)
Many Thanks