Date: Thu, 26 Jul 2007 10:03:04 -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: skip a loop to next in a sas macro
In-Reply-To: A<1185469193.194263.172000@g4g2000hsf.googlegroups.com>
Content-Type: text/plain; charset="US-ASCII"
Hi,
To have the %IF reference the macro
variable "i" you need an ampersand.
%macro test2;
%do i = 1 %to 5;
%if &i = 3 %then %goto continue;
%put i = &i.;
%continue:
%end;
run;
%mend;
%test2
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investments
Russell Investments
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
sas_9264
Sent: Thursday, July 26, 2007 10:00 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: skip a loop to next in a sas macro
Hi, I have following test code:
%macro test2;
%do i = 1 %to 5;
%if i = 3 %then %goto continue;
%put i = &i.;
%continue:
%end;
run;
%mend;
%test2
it output to log as:
i = 1
i = 2
i = 3
i = 4
i = 5
what I expect:
i = 1
i = 2
i = 4
i = 5
What do I miss to get expect result?
Thanks a lot,
shiping