Date: Fri, 30 May 2008 21:08:36 -0700
Reply-To: RolandRB <rolandberry@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: RolandRB <rolandberry@HOTMAIL.COM>
Subject: Re: %IF usage to compare Strings
Content-Type: text/plain; charset=ISO-8859-1
On May 31, 2:14 am, ab_sha...@YAHOO.COM.SG (abshakes) wrote:
> Hi Guys,
> I am having problems with comparing Strings using %if in a macro setting.
> For example : I know that CommandString = Slope ;
> But I want the Value of the macro variable : i.e.
> CommandString = Slope ; Level ;
> whenever CommandString = Slope ;
> I use the following code:-
> %if &CommandString=slope %str(;) %Then %CommandString=level%Str(;)slope%str(;);
> But unfortunately, the above code returns False even though its True.
"slope" is not the same as "Slope". Look at the following.
8 %macro test;
9 %let CommandString=Slope %str(;);
10 %put >>> &CommandString;
11 %if &CommandString=Slope %str(;) %then %put They are the same;
12 %mend test;
>>> Slope ;
They are the same
> Is there a way to break out of a loop in Macro? Inother words if a loop in the macro returns an error, it keeps repeatingt till the program crashes....in other words is there a way I can break oout of the loop dynamicaly and resume it with a new dataset?
> Your help is highly appreciated.
> Many Thanks !!
Depending on the situation, just %goto out of it and jump to a label.