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 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 8 Feb 2008 16:48:29 -0500
Reply-To:   Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject:   Re: using a SAS data set to inform a macro
Comments:   To: "Kevin F. Spratt" <Kevin.F.Spratt@DARTMOUTH.EDU>

On Fri, 8 Feb 2008 16:17:32 -0500, Kevin F. Spratt <Kevin.F.Spratt@DARTMOUTH.EDU> wrote:

>I have written a program that uses proc compare to look for >differences in data entry. ... >My problem is that I need to do this for 14 separate tables and I will >need to do this regularly as these tables continue their growth. > >My "plan" is to create a separate SAS data set that includes the >Access table names and several of the variable names from each table >that are needed for the proc compare program I have created to work. >My hope is that I can create a macro that will loop through this SAS table >one record at a time where each record provides the keywords needed to >create the appropriate BASE and COMPARE data sets for each table. > >I have written the macro that does the work, for any given table when >I input the correct keywords, but I can't figure out how to inform the >macro based on the SAS data set I have created that summarizes the table >and I'm not sure about how to loop through through the tables. ...

hi, kevin, Use the execute() call routine. hth. cheers, chang p.s. proc compare is that good, huh?!

/* your macro. here we assume a dummy. */ %macro comp(base=, comp=); %put base=&base. comp=&comp.; %mend comp;

/* dataset with parameters */ data tables; length base compare $32.; input base $ compare $; cards; tbl_oneB tbl_oneC tbl_twoB tbl_twoC ; run;

/* call macro %comp dynamically */ data _null_; set tables; call execute(cat('%comp(base=',base,',comp=',compare,')')); run;

/* on log base=tbl_oneB comp=tbl_oneC base=tbl_twoB comp=tbl_twoC */


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