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 (June 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 22 Jun 2007 10:41:56 -0400
Reply-To:     "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject:      Re: Could this be a bug with %SYMDEL ?
In-Reply-To:  <200706220027.l5LHScBv009002@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=us-ascii

> From: Lorne Klassen > There appears to be a SAS bug having to do with trying to > delete a global loop counter macro variable with %SYMDEL. Try > running this code exactly as is.

1. Check your design: handling global macro variables inside a macro is not(Best Practice)

2. factoid: symdel cannot be used inside a macro because of scope note: parameters and other local macro variables are deleted at end of macro SymDel is supposed to work on the global symbol table therefore (I think) it has been disabled inside macros

3. YeahBut: How to do this, anyway? delay the execute of the SymDel until you are out of the macro

> %MACRO test(x=); > %GLOBAL process_number; > %LOCAL i; > > %DO process_number = 1 %TO 10; > %IF (&process_number = &x) %THEN %GOTO exit; > %DO i = 1 %TO 34; > %END; > %END; > > %exit: data _null_; call execute('%nrstr(%SYMDEL process_number;)'); stop; run; > %MEND test;

> %test(x=3) ;run;

> %PUT process_number = &process_number; > > %test(x=0) > %PUT process_number = &process_number; > > %test(x=0) > %PUT process_number = &process_number;

Ron Fehd the call execute or macro maven CDC Atlanta GA USA RJF2 at cdc dot gov

--> cheerful provider of UNTESTED SAS code from the Clue?Gee!Wrx <--

By using your intelligence you can sometimes make your problems twice as complicated. -- Ashleigh Brilliant


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