Date: Wed, 8 Aug 2007 08:29:26 -0400
Reply-To: Mike Rhoads <RHOADSM1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Rhoads <RHOADSM1@WESTAT.COM>
Subject: Re: Nest a macro inside a %do loop based on an outside file of
Content-Type: text/plain; charset="us-ascii"
Here's one more possibility: get the ID of each entity into a SAS data
set (if you don't have one already), and write a driver macro that goes
through the data set, using the SAS File I/O functions (OPEN, FETCH,
etc.), and calls the reporting macro for each ID.
If the reason for needing 15,000 calls to your reporting macro is to
keep all of the output for each entity together, take a look at the
classic Ray Pass paper, "What We Really Need is a %BY Statement - V2"
Another approach that has always intrigued me, but which I have never
tried out, is to run each part of your reporting process separately for
all entities with a BY statement, routing the output to the DOCUMENT
destination, and then use PROC DOCUMENT to reorder the output objects so
they are grouped by entity. I suspect you would need some macro code to
generate the PROC DOCUMENT statements. A possibly fatal flaw to this
approach is that, prior to the elusive SAS 9.2, PROC REPORT does not
work with the DOCUMENT destination.
From: firstname.lastname@example.org [mailto:email@example.com]
On Behalf Of Louise Hadden
Sent: Tuesday, August 07, 2007 4:55 PM
Cc: Louise Hadden
Subject: Nest a macro inside a %do loop based on an outside file of
I have a fairly complex reporting program that I will be doing for
15,000 entities, with 8 separate PDF reports for each entity. The
involves several different procedural calls using various files at
different levels of aggregation inside an ODS PDF startpage=never call.
While testing, I simply used a macro with the entity ID as an argument
which works fine. But being supremely lazy I don't want to type in all
those entity ids.... While I COULD create a &list with all the entity
and loop through, somehow the &list has to be specified (more typing!),
I'm wondering if at some point the &list would get too long for SAS
(whether I typed it in or created it programmatically.) It would be
if this could be data driven because the list of entities changes over
time. Does anyone have any suggestions? Due to the use of several
different data bases within the reporting macro, looping inside a data
doesn't really work, but essentially, that's what I'd like to do. I'm
developing the code on a PC and testing it in 9.1.3 on a z/OS mainframe
system (it will eventually be run on the mainframe.)
Any help greatly appreciated!