Date: Wed, 30 Jan 2008 09:27:49 -0500
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: Call Execute question
In-Reply-To: <OF2234DDE1.C43CCCD3-ON862573DF.0072A3B3-862573DF.00730E52@fd9ns01.okladot.state.ok.us>
Content-Type: text/plain; charset=us-ascii
> From: mpajoh
> Why when I submit this the "call execute" only runs for the last
> observation?
> date1 is a variable in data set "a".
>
> Data _null_;
> set a;
> call execute('%lexist(Estimates,'||date1||');');
> run;
>
> I want it to run for all observations in "a".
> thanks.
>
> I use SAS 9.1.1.3 on XP.
note: you did not provide the macro lexist
so we are left to guess whether it has complexity
which will cause the macro calls to fail.
see the explanation in the paper cited below.
You need to have these things here:
* named parameters
* ability to test and debug
* wrap macro call in NoRescanString
Data _null_;
attrib Stmnt length = $72
Testing length = 4;
retain Testing 1;*or 0;
set a;
Stmnt = cats('%lexist('
, 'Estimates=',Estimates
,',date1=' ,date1
,')'
);
if Testing then putlog Stmnt=;
call execute(cats('%nrstr(',Stmnt,')'));
run;
The reasons to use NoRescanString are covered this paper.
List Processing Basics:
Creating and Using Lists of Macro Variables
Ronald J. Fehd and Art Carpenter
http://www2.sas.com/proceedings/forum2007/113-2007.pdf
All code examples in the paper are on SAScomm.wiki in the zip
http://www.sascommunity.org/wiki/List_Processing_Basics_Creating_and_Usi
ng_Lists_of_Macro_Variables
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov