LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 26 Apr 2010 11:16:02 -0400
Reply-To:     Ya Huang <ya.huang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ya Huang <ya.huang@AMYLIN.COM>
Subject:      Re: Proc FCMP, Call Execute and timing of macro run
Comments: To: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>

Hi Muthia,

Thanks for the tip. This is very interesting, though I still have trouble fully understand how it works: So the macro now has no parameter, but still has to use a macro var to communicate with outside world.

%let name = %sysfunc(dequote(&name));

The line above implies that name macro var is global available, but in the code, there is no line to define it. Unless run_macro('myprint', name) function first turns name into a macro var. Sounds almost like a call symput is inside the run_macro?

More insight about this yet another "undocumented" feature would be nice.

Fully understand how it works may lead to more elegant and powerful code, which may simplify many cumbersome macro based program.

Ya

On Sun, 25 Apr 2010 11:23:01 -0500, Muthia Kachirayan <muthia.kachirayan@GMAIL.COM> wrote:

>Ya, > >Not well documented for FCMP but you can get what you wanted by using the >following without changes to other codes. > >%macro myprint; >%let name = %sysfunc(dequote(&name)); > proc sql noprint; > select sum(weight,height) into :wh > from sashelp.class > where name="&name" > ; > %put >>>&wh<<<; >%mend myprint; > >Regards, > >Muthia Kachirayan >On Fri, Apr 23, 2010 at 3:51 PM, Ya Huang <ya.huang@amylin.com> wrote: > >> Hi there, >> >> At SGF2010, I attended a seminar "Adding Statistical Functionality to the >> DATA Step with PROC FCMP". I was under the impression that RUN_MACRO >> function can solve the call execute runing macro's timing issue. I actually >> asked the question during the Q&A, and the presenter seemed to agree. Today >> I was able to do some testing and it seems that my impression was wrong: >> >> >> 1 %macro myprint(name); >> 2 proc sql noprint; >> 3 select sum(weight,height) into :wh >> 4 from sashelp.class >> 5 where name="&name" >> 6 ; >> 7 %put >>>&wh<<<; >> 8 %mend myprint; >> 9 >> 10 proc fcmp outlib = work.ds.functions; >> 11 function myprint(name $); >> 12 rc = run_macro('myprint', name); >> 13 return; >> 14 endsub; >> 15 run; >> >> NOTE: Function myprint saved to work.ds.functions. >> NOTE: PROCEDURE FCMP used (Total process time): >> real time 0.06 seconds >> cpu time 0.00 seconds >> >> >> 16 >> 17 options cmplib = (work.ds) mprint; >> 18 >> 19 data _null_; >> 20 set sashelp.class; >> 21 rc=myprint(name); >> 22 run; >> >> MPRINT(MYPRINT): proc sql noprint; >> MPRINT(MYPRINT): select sum(weight,height) into :wh from sashelp.class >> where name="" ; >> WARNING: Apparent symbolic reference WH not resolved. >> >>>&wh<<< >> MPRINT(MYPRINT): proc sql noprint; >> MPRINT(MYPRINT): select sum(weight,height) into :wh from sashelp.class >> where name="" ; >> WARNING: Apparent symbolic reference WH not resolved. >> >>>&wh<<< >> >> >> As it is shown in the log above, macro WH is still not available. I was >> under the impression that it should be. >> >> For call execute, we can use %nrstr() to delay the macro resolving. With >> FCMP created function, how do we do that? >> >> Ya >>


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