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 (May 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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>
Organization: http://groups.google.com
Subject:      Re: %IF usage to compare Strings
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On May 31, 2:14 am, ab_sha...@YAHOO.COM.SG (abshakes) wrote: > Hi Guys, > Question1 > 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; 13 %test >>> Slope ; They are the same

> Question2 > 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.


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