Date: Tue, 9 Apr 1996 00:53:04 +0100
Reply-To: John Whittington <johnw@MAG-NET.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: John Whittington <johnw@MAG-NET.CO.UK>
Subject: Re: macro to create data sets -Reply
On Mon, 8 Apr 1996, Robert Abelson <ROBERTA@OTSUKA.OAPI.COM> wrote, in
response to the question from Kratzke_D <KratzkeD@OEUS.PSB.BLS.GOV>:
>This is untested, but should be close to what you want:
>
>%macro mcreate;
>
>%do i=1 %to 12;
>
>%let j=&i - 1;
>
>data m&i;
> set sample;
> if resp&i=1 and resp&j=1;
>run;
>%end;
>%mend;
>
>%mcreate
Robert, it looks as if it should work, but is it 'efficient'? You are
running the DATA step (inclkuding reading the whole of SAMPLE, which could
be enormous) 12 times. Would it not be better to have a DATA step which can
(and read) only once, with 12 conditional OUTPUT statements?
In fact, I personally would not use a macro for this (see separate posting
from me), although I realise that many would - and can certainly see
advantages if we were dealing with a lot more than 12 output files.
John
-----------------------------------------------------------
Dr John Whittington, Voice: +44 1296 730225
Mediscience Services Fax: +44 1296 738893
Twyford Manor, Twyford, E-mail: johnw@mag-net.co.uk
Buckingham MK18 4EL, UK CompuServe: 100517,3677
-----------------------------------------------------------
|