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 (July 1998, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 21 Jul 1998 10:42:29 +0500
Reply-To:     Bernard Tremblay <bernard@CAPITALE.QC.CA>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Bernard Tremblay <bernard@CAPITALE.QC.CA>
Subject:      Re: Local macro variables
Comments: To: SeidlZ@TESCOSW.CZ

Hi,

I think your problem come from the 'execute' function. The call execute tries to resolve the macro BEFORE passing the text to SAS, but you're already in a datastep and your macro have to call a datastep wich is going to be executed next to resolve the value of XXX. So, in short, you're asking SAS to show you a value it has not yet obtained !

If you look carefully in the SAS online documentation about the execute function, you will notice this ...

Another way to get this type of comflict is to mix '%let' and '%include' with call execute function. The '%let' will be resolved immediatly, but the '%include' will be executed after: so you will have many %include with the last value of the variable you set in the '%let'...

I hope it clarifies the matter!

Regards, Bernard Tremblay \\\|/// \\ - - // ( @ @ ) +------oOOo-(_)-oOOo----------+---------------------------------+ | Bernard Tremblay | | | La Capitale | Tel: (418) 646-2401 | | | Fax: (418) 646-5960 | | | Int: bernard@capitale.qc.ca | +-----------------------------+---------------------------------+ | Imaginasys enr | Res: (418) 658-1411 | | | Int: bertrem@quebectel.com | +---------------Oooo----------+---------------------------------+ oooO ( ) ( ) ) / \ ( (_/ \_) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>Date: Tue, 21 Jul 1998 15:51:42 +0200 >>>From: Zdenek Seidl <SeidlZ@TESCOSW.CZ> >>>Subject: Local macro variables >>>To: SAS-L@UGA.CC.UGA.EDU >>> >>>Hello >>>I'm young sw developer from czech republic and this is my first >>>message i'm sending to this mailing list, so please don't leave >>>it without answer. >>> >>>I've such problem: I need to write macro, which uses local macro >>>some local macro variables. This is not the problem, the problem >>>comes, as i try to call this macro by using 'call execute' statement. >>>See example below ... >>> >>>%macro sample; >>> %local xxx; >>> data _null_; >>> call symput("xxx","TEST"); >>> run; >>> %put _all_; >>>%mend sample; >>> >>>When I call this macro by >>> >>>%sample; >>> >>>everything is ok and in the log window is displayed macro variable xxx >>>with scope 'sample' and value 'TEST'. But when i call this macro by >>> >>>data _null_; >>> call execute('%sample;'); >>>run; >>> >>>then the macro variable xxx is not filled and the message log stays >>>clear. >>>I've verified, that the macro variable xxx is not set to any value in >>>this case. >>> >>>WHAT'S WRONG ???? Is it impossible to use local macro variables >>>when calling macros by using 'call execute' ??? >>> >>>Please, if you know the answer, let me know. It is very important for >>>me. >>> >>>Thanx >>> Zdenek Seidl >>> >>>PS: Excuse my poor english ;)


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