Date: Thu, 19 Feb 2004 10:46:53 -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: Macro Execution in a Datastep
Content-Type: text/plain; charset="us-ascii"
> From: Jim Bob Shifflet [mailto:jimbobinva@HOTMAIL.COM]
> My simple problem is that I want to evaluate each observation
> in a dataset and execute a macro given a certain condition.
> After reading the archives it appears that I need to use
> either call symput or call execute or both. However, I am
> obviously missing something regarding execution time and
> resolution of the variables. Below is my example which doesn't work:
> data test1;
> input var1 $ var2 $;
> a a
> b z
> c c
> data test2;
> set work.test1;
> if var1 NE var2 then
> call symput('var1', var1);
> call symput('var2', var2);
> call execute ('%put &var1 is not equal to &var2');
* this %put statement will not tell you what you think it will;
put var1= ' is not equal to ' var2=);
> Any help would be appreciated. Please go easy on this
> country boy just learning macro programming.
you need to come up to speed on data step programming
before you jump, feet first, into macro programming.
run the above with the do ... end loop and the debugging put statements
and get back to us with the macro that you want to execute
with var1 and var2 as parameters
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
By using your intelligence
you can sometimes make your problems twice as complicated.
-- Ashleigh Brilliant