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 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 27 Oct 2008 10:20:48 -0400
Reply-To:   Jack Clark <jclark@HILLTOP.UMBC.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jack Clark <jclark@HILLTOP.UMBC.EDU>
Subject:   Re: Warnings about Global macro variables created in Macro Program that is called with CALL EXECUTE
Comments:   To: "./ ADD NAME=Data _null_," <iebupdte@gmail.com>
In-Reply-To:   <ce1fb7450810270703q1e104f04n809034d786dade21@mail.gmail.com>
Content-Type:   text/plain; charset="us-ascii"

_null_,

Thank you for the response. Your suggestion solved my problem. I knew it was a timing problem, but wasn't sure how to solve it.

Jack

Jack Clark Senior Research Analyst phone: 410-455-6256 fax: 410-455-6850 jclark@hilltop.umbc.edu

University of Maryland, Baltimore County Sondheim Hall, 3rd Floor 1000 Hilltop Circle Baltimore, MD 21250

-----Original Message----- From: ./ ADD NAME=Data _null_, [mailto:iebupdte@gmail.com] Sent: Monday, October 27, 2008 10:03 AM To: Jack Clark Cc: SAS-L@listserv.uga.edu Subject: Re: Warnings about Global macro variables created in Macro Program that is called with CALL EXECUTE

call execute('%nrstr(%classage (age='||age||'));');

You want to delay execution of the macro AND the statements it generates.

just like you had written each macro call

%classage(... %classage(... %classage(...

Check the docs for details about when the MACRO executes in relation to the code(data/proc steps) generated by the macro.

On 10/27/08, Jack Clark <jclark@hilltop.umbc.edu> wrote: > Good morning, > > > > I would like to understand some Warning messages I am getting in my SAS > log when calling a macro program with CALL EXECUTE. I have tried to > create a simplified version for posting to SAS-l, so it may seem > somewhat contrived. > > > > Basically, I have a macro program which accepts a parameter. The macro > program is called from a DATA _null_ with the CALL EXECUTE syntax. > Inside the macro program, additional macro variables are created using > PROC SQL. Also inside the macro program, the created macro variables > are assigned to DATA step variables so the values can be used in an > audit report. > > > > > > %macro classage (age=); > > > > proc sql noprint; > > select put (count (*), 12.-L) > > into :old_cnt > > from sashelp.class > > ; > > select put (count (*), 12.-L) > > into :new_cnt > > from sashelp.class > > where age = &age > > ; > > quit; > > > > > > data audit; > > student_age = &age.; > > totcnt = &old_cnt.; > > cnt = &new_cnt.; > > run; > > > > proc append base = audrpt data = audit; > > run; > > > > proc sql; > > drop table audit > > ; > > quit; > > > > > > %mend classage; > > > > data test; > > input age $ @@; > > cards; > > 11 12 13 > > ; > > run; > > > > data _null_; > > set test; > > call execute('%classage (age='||age||');'); > > run; > > > > proc print data = audrpt; > > run; > > > > > > Here is the issue I am having. When the CALL EXECUTE runs, it sees > references to macro variables which are not created yet (the ones from > PROC SQL) and gives a message in the log that APPARENT SYMBOLIC > REFERENCE NOT RESOLVED. Otherwise, the logic works fine. > > > > Can someone explain the cause for this and recommend a way to prevent > the WARNING messages from showing in the log? I know that the > references to those macro variables are not resolved because they have > to be created with the PROC SQL inside the macro program first. > > > > Thanks in advance, > > > > > > > > Jack Clark > Senior Research Analyst > phone: 410-455-6256 > fax: 410-455-6850 > jclark@hilltop.umbc.edu > > University of Maryland, Baltimore County > Sondheim Hall, 3rd Floor > 1000 Hilltop Circle > Baltimore, MD 21250 > > > > > Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you. >


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