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 (March 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 10 Mar 2011 13:20:02 -0500
Reply-To:   Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject:   Re: "Unpacking" variable in a datastep into a "macro function"
Comments:   To: Webb Spr <Webb.Sprague@OFM.WA.GOV>

On Thu, 10 Mar 2011 09:17:06 -0800, Sprague, Webb (OFM) <Webb.Sprague@OFM.WA.GOV> wrote: ... >I imagine it is a problem with (un)quoting and sysfunc and prxmatch, but >I am baffled and would appreciate any advice I can get... ... hi, Webb, here is one way. This is sometimes called as a function-style macro, since it can be "called" as if it were a function. under the hood, however, the macro resolves into an expression to be compiled and executed as a part of a statement. cheers, chang

%macro type(txt); %let txt=(upcase(compress(&txt," ","psc"))); (ifc(prxmatch("/RE*MO*DE*L/",&txt),"REMODEL","BUILDNEW")) %mend type;

/* check */ data _null_; do var = "remodel", "model"; type = %type(var); put var= type=; end; run; /* on log var=remodel type=REMODEL var=model type=BUILDNEW */


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