Ahh sorry I guess I didnt read far enough, thats my fault and I apologies:
For that you need :
%macro test2;
%do i = 1 %to 5;
%if ( &i ne 3 ) %then %put i = &i ;
%end;
%mend test2 ;
%test2
Toby Dunn
If anything simply cannot go wrong, it will anyway. Murphys Law #2.
The buddy system is essential to your survival; it gives the enemy somebody
else to shoot at.
Murphys Law #
Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch to be
sure. Murphys Law #9
From: "Shiping Wang" <***@gmail.com>
To: "toby dunn" <***@hotmail.com>
Subject: Re: skip a loop to next in a sas macro
Date: Thu, 26 Jul 2007 13:07:28 -0500
Hi toby, thanks for your response. I tried your code it print out:
i = 1
i = 2
seems %return is completely out of loop. What I want is skip i=3 but
continue with next loop. So it can print:
i = 1
i = 2
i = 4
i = 5
Shiping
Post by toby dunnShipng ,
%macro test2;
%do i = 1 %to 5;
%if i = 3 %then %return ;
%put i = &i.;
%end;
%mend test2 ;
%test2
Toby Dunn
If anything simply cannot go wrong, it will anyway. Murphys Law #2.
The buddy system is essential to your survival; it gives the enemy
somebody
else to shoot at.
Murphys Law #
Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch to be
sure. Murphys Law #9
Subject: skip a loop to next in a sas macro
Date: Thu, 26 Jul 2007 16:59:53 -0000
%macro test2;
%do i = 1 %to 5;
%if i = 3 %then %goto continue;
%put i = &i.;
%end;
run;
%mend;
%test2
i = 1
i = 2
i = 3
i = 4
i = 5
i = 1
i = 2
i = 4
i = 5
What do I miss to get expect result?
Thanks a lot,
shiping
_________________________________________________________________
Need a brain boost? Recharge with a stimulating game. Play now!
http://club.live.com/home.aspx?icid=club_hotmailtextlink1
_________________________________________________________________
http://liveearth.msn.com