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 (December 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 11 Dec 2002 08:58:05 -0500
Reply-To:     "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject:      Re: recruiting cheesy, sleasy SAS tricks tip call execute
Comments: cc: "michael@BASSETTCONSULTING.COM" <michael@BASSETTCONSULTING.COM>
Content-Type: text/plain

> From: Michael L. Davis [mailto:michael@BASSETTCONSULTING.COM] > I'd like to do a Coder's Corner presentation at NESUG next > year on the subject of "Cheesy, Sleasy SAS Tricks". > - Michael "Mad Doggy" Davis

What a pile of bones you are collecting here, MadDog! Don't know the cheese factor of this one. maybe ToFu?! LOL %-D

This is a trick I use for debugging call execute

enabling the mVar CMD=put Cmd; will write your call execute statements to file PRINT; once they look correct then disable that statement. and your code executes.

using NoRescanString inside call execute guarantees that macro calls in Cmd will execute when popped not pushed.

NOTE: call execute will not work correctly, i.e., as you expect, when you pass a complex macro call to it. a macro with complexity is one that has symput, or macro control statements: %IF or %DO, etc.

DATA X;MemName='X';output;stop;run; %*note:MemName is available from DICTIONARY.TABLES;

%LET CMD = call execute('%nrstr(' !! Cmd !! ');' ); %LET CMD = put Cmd;%*TESTING;

%LET LIBREF = WORK; %LET DATA = X; %LET CONDITION =1;%*for testing;

%MACRO TEST1(DATA=);PROC FREQ data = &DATA.;run;%MEND; %MACRO TEST2(DATA=,COND=); %IF &COND. %THEN %DO; PROC FREQ data = &DATA.;run;%END;%MEND; DATA _NULL_; length Cmd $ 72;%*may be longer; file PRINT; do until(EndoFile); set WORK.&DATA. (where = (&CONDITION.)) end = EndoFile; Cmd = "proc PRINT data = &LIBREF.." !! trim(MemName) !! ';'; &CMD.; Cmd = "%TEST1(DATA=&LIBREF.." !! trim(MemName) !! ');'; &CMD.; Cmd = "%TEST1(DATA=&LIBREF.." !! trim(MemName) !! ",COND=1);'; &CMD.; %*do until(EndoFile);end; stop; run; %*NOTE: call execute happens in this step; run;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov

If you think I know what I'm doing it's probably because you know even less about it. -- Pot-Shots by Ashleigh Brilliant

do not fold, spindle, or mutilate -- IBM punch card ... the call execute argument(s)


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