Date: Tue, 18 Jun 2002 17:01:54 -0400
Reply-To: Ray Pass <raypass@ATT.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ray Pass <raypass@ATT.NET>
Subject: Re: Problem in cycling through data
In-Reply-To: <9D17D648E4EBD311AD45009027D0DF9302EAF0F2@MCDC-ATL-64>
Content-Type: multipart/alternative;
Oh so many ways to do it. Here's what I might use, based on the fact that
the lists of DOCS and FACS are gonna be read into vars doc and fac in data
set testfac (assume %analysis is previously defined):
*-------------------------------------------------;
proc sql;
create table testfac2 as
select distinct doc, fac
from testfac;
select count(*),
trim(doc)||'*'||trim(fac)
into :ct,
:mdocfacall separated by '#'
from testfac2;
quit;
*-------------------------------------------------;
%macro cycle;
%do n=1 %to &ct;
%let mdocfac = %scan(&mdocfacall,&n,#);
%let mdoc = %scan(&mdocfac,1,*);
%let mfac = %scan(&mdocfac,2,*);
%analysis(doc=&mdoc, fac=&mfac);
%end;
%mend;
%cycle
*-------------------------------------------------;
Just another (untested) suggested solution.
Ray
>At the start, I define the surgeon
>and hospital in separate macro variables
>
>%Let fac="MCD"
>%Let doc = "Smith"
>
>and use them in the analysis macro. This works great. After
>the report is
>saved, I manually change the values of the macro variables to a new
>surgeon/hospital combination and run it again.
>
>This all works fine, but makes me type in too many
>surgeon/hospital combos.
>I would like to create a list of the combinations and then
>have the programcycle through them.
>
>I can read them into a new dataset using
>
>DATA testfac;
>INPUT doc fac;
>CARDS;
>doc1 fac1
>doc2 fac2;
>
>etc.
>
>However I seem to be unable to generate the code to cycle
>through the data
>set, having it select each combo into the macro variables,
>then calling the
>macro. Usually I only get it loading the last combination
>from the data set
>and running the macro.
>
>I would appreciate any suggestions from the group. My appreciation in
>advance for any input.
*------------------------------------------------*
| Ray Pass, Ph.D. voice: (914) 693-5553 |
| Ray Pass Consulting eFax: (914) 206-3780 |
| 5 Sinclair Place cell: (914) 450-0555 |
| Hartsdale, NY 10530 e-mail: raypass@att.net |
*------------------------------------------------*
[text/html]
|