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 (October 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 19 Oct 2007 11:31:24 +0100
Reply-To:     Guido T <cymraegerict@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Guido T <cymraegerict@GMAIL.COM>
Subject:      Re: positional macro parameter as keyword
Comments: To: "ckxplus@yahoo.com" <ckxplus@yahoo.com>
In-Reply-To:  <1192787192.450004.173400@y27g2000pre.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi,

Something similar used to be in the "gotcha" test we did for SAS programmer interviews.

Given the following code ...

%macro m(x); %put &x.; %mend;

%m(a); %m(x=b); %m(x=b=c); What would you expect to see in the log ...

1 %macro m(x); 2 %put &x.; 3 %mend; 4 5 %m(a); *a *6 %m(x=b); *b *7 %m(x=b=c); *b=c * Not a very useful test :)

++ Guido

On 19/10/2007, ckxplus@yahoo.com <ckxplus@yahoo.com> wrote: > > It's more than 20 years ago since I wrote my first macro. But today I > (inadvertently) discovered that you can refer to a positional > parameter as a keyword, provided you use the right name. For example: > > %macro test(data); > %put data=&data; > %mend; > > %test(demo); > %test(data=demo); > > This prints 'demo' to the log in both cases. Could be a useful feature > sometimes. Am I the only one in the dark about this feature? > > John Hendrickx >


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