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 (July 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: sas_9264 <Shiping9264@GMAIL.COM>
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


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