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 (February 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: cc: Jim Bob Shifflet <jimbobinva@HOTMAIL.COM>
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 $; > cards; > a a > b z > c c > ; > run; > > data test2;

file PRINT;

> set work.test1; > if var1 NE var2 then

do;

> 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=); end;

> run; > > 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


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