Date: Thu, 6 Feb 2003 17:20:19 GMT
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roger Lustig <trovato@BELLATLANTIC.NET>
Subject: Re: Processing AGE datasets
Content-Type: text/plain; charset=us-ascii; format=flowed
What you really need is a macro that checks to see how many data sets
there are, and then writes the SET statement for you.
%* Maximum number of files;
%* Loop until you find the last file;
% do %until(&flag=YES);
%if (%sysfunc(exist(&libname..&prefix.lastfile))) %then %let flag=YES;
%else %let lastfile = %eval(&lastfile - 1);
%* Start your DATA step;
%* Enumerate the files you want in the SET statement;
%do I=1 %to &lastfile;
%* Remember the semicolon!;
*** Invoke the macro;
*** Do your selection and anything else;
where <selection criterion>;
<other SAS statements>;
David Kellerman wrote:
> I have a group of datasets in a database created by AGEing... i.e.: DAT1;DAT2;DAT3;DAT4 ... DATxxx.(maximum 100)
> Perhaps I am going about this the hard way, but I want to be able to process the x number of datasets in a loop, selecting off specific records from each dataset. I can't use a SET statement because I do not know in advance how many datasets there are. I attempted to write a macro to go through, but have not been able to get it to work as yet.
> Any suggestions. I would think if SAS created the AGEing process, there would be a simple way to process each dataset in the group.
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now