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 (July 2004, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 29 Jul 2004 14:08:12 -0600
Reply-To:     Roberto Valdivia <valdivia@MONTANA.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Roberto Valdivia <valdivia@MONTANA.EDU>
Subject:      Re: Several datasets, one program -It works
In-Reply-To:  <200407282124.i6SLOsJ15502@listserv.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

Howard,

Thanks for your macro. I used it and modified it a little bit, and now it works, I can run the same program using several datasets in one run.

Thanks!

Roberto

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Howard Schreier Sent: Wednesday, July 28, 2004 3:25 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Several datasets, one program

I would create one macro to run your program once, with the two parameters (dataset number and the other one) as arguments. Then have a second macro loop and invoke the first macro. Here's an example:

data demo1; retain v 1; run;

data demo2; retain v 2; run;

%macro program(dsnum=,dplaces=);

data out&DSNUM&DPLACES; set demo&DSNUM; format v 6.&DPLACES; run;

%mend program;

%macro loop(times=);

%do i = 1 %to &TIMES; %program(dsnum=&I, dplaces=1) %program(dsnum=&I, dplaces=3) %end;

%mend loop;

%loop(times=2)

On Wed, 28 Jul 2004 12:18:47 -0600, Roberto Valdivia <valdivia@MONTANA.EDU> wrote:

>Dear All, > >Maybe somebody has an idea on how to make this problem easier: > >I have a SAS program that uses 1 dataset (A.dbf) as input and I get one >dataset as output (Z.dbf). >I have 28 datasets "A" (a1..A28), which means that I have to run the program >28 times, >But there is more: I also have to change a value in one parameter in >the SAS >program, >which means that I actually have to run the program 56 times and get >the final databases (ZA1_1, ZA1_2, ZA2_1, ZA2_2,...ZA28_1, ZA28_2). > >Is there any way (macro, program, etc?) that I can use so I can run a single >program >And it automatically changes/updates : a. The input database name b. >the Output database name and c. the parameter value inside the program >(The first two are the key, if >the parameter >value cannot be changed but the input and output database names can, >then I still will save a lot of time, I just will have to run again the >program with the other parameter's value) > >I don't know how complicated or easy this is, but any help will be welcome!. > >Thanks, > >Roberto


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