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 (August 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
              entity ids
Comments: To: Louise Hadden <louise_hadden@ABTASSOC.COM>
In-Reply-To:  <200708072054.l77JFN3v014886@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

Louise,

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" (http://www2.sas.com/proceedings/sugi25/25/cc/25p083.pdf).

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.

Have fun!

Mike Rhoads Westat RhoadsM1@Westat.com

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Louise Hadden Sent: Tuesday, August 07, 2007 4:55 PM To: SAS-L@LISTSERV.UGA.EDU Cc: Louise Hadden Subject: Nest a macro inside a %do loop based on an outside file of entity ids

I have a fairly complex reporting program that I will be doing for around 15,000 entities, with 8 separate PDF reports for each entity. The program 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 ids and loop through, somehow the &list has to be specified (more typing!), and 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 best 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 step 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!


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