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 (January 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 16 Jan 2009 15:35:42 +0000
Reply-To:   karma <dorjetarap@GOOGLEMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   karma <dorjetarap@GOOGLEMAIL.COM>
Subject:   Re: question about sas macro variables
Comments:   To: "./ ADD NAME=Data _null_," <iebupdte@gmail.com>
In-Reply-To:   <ce1fb7450901160719s18e3eb4dra430322efa00fab1@mail.gmail.com>
Content-Type:   text/plain; charset=ISO-8859-1

Amazing! I agree, no use of this comes straight to mind, other than being a nice addition to Art Carpenters "Maximise Your Indespensability" paper, but it is nontheless very cool.

I will try to think of a practical use for this :)

Thanks

2009/1/16 ./ ADD NAME=Data _null_, <iebupdte@gmail.com>: > On 1/16/09, karma <dorjetarap@googlemail.com> wrote: >> I think this raises another interesting question, can SAS macro create >> macro code that is executable at a later time? As far as I know, Lisp >> allows macro code to create macro code ad infinitum. I don't think SAS >> does allow this, but I would be happy to be proven wrong on this. An >> example: >> >> %let c = %superq(%put 1;); >> %unquote(c); > > This doesn't work because SUPERQ only works on macro variables and the > unquote is missing & for &C. But it can be made to work see lines 1 > and 2 below. The rest is a macro that writes a macro. I can't think > of a use for this today but I think I actually coded something similar > many years ago when I was "macro happy". > > > > 1 %let c = %nrstr(%%put NOTE: &systime;); > 2 %unquote(&c); > NOTE: 09:08 > 3 > 4 > 5 %macro writes1(name=hello); > 6 %let macro = %nrstr(%%)macro &name(called=&sysmacroname) > %nrstr(; %%put NOTE: MY name is &sysmacroname, > 6 ! called by &called; %%mend;); > 7 %put _local_; > 8 %unquote(&macro) > 9 %unquote(%&name) > 10 %mend writes1; > 11 > 12 > 13 %writes1; > WRITES1 MACRO macro hello(called=WRITES1) put NOTE: MY name is > sysmacroname called by called mend > WRITES1 NAME hello > NOTE: MY name is HELLO, called by WRITES1 >


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