|Date: ||Tue, 22 May 2007 18:00:30 -0400|
|Reply-To: ||Ed Heaton <EdHeaton@WESTAT.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Ed Heaton <EdHeaton@WESTAT.COM>|
|Subject: ||Re: Work Library Files for a Macro System|
|Content-Type: ||text/plain; charset="us-ascii"|
I wrote a paper for the Forum on the topic. See
Edward Heaton, Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1650 Research Boulevard, RW-4541, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 294-3879
From: email@example.com [mailto:firstname.lastname@example.org]
On Behalf Of Paul Walker
Sent: Tuesday, May 22, 2007 5:22 PM
Subject: Work Library Files for a Macro System
I am developing / have developed a set of macros, aka "macro system".
Most of the macros use the WORK library as the primary location to
temp datasets which are then deleted at the conclusion of the macro.
one thing that tends to cause a problem with macros is how you name the
temporary datasets written to the work library. You might over-write
other files that already exist in the work library. Or, if you need to
recursively call a macro, at each recursion you may be over-writing the
dataset from the last recursion.
I have some ideas about how to solve this problem:
 Name all the temp datasets with a prefix according to the name of
 Add a timestamp (date+time) integer to the dataset name
 Put error checking logic into the macro so that it only runs if the
datasets which it will create do not already exist
 Need more ideas...
Essentially, all files written to the work library are "Global" in scope
for a SAS session and I need to prevent conflicts between them. I would
like to create "Local" scope datasets for each time a macro is invoked.
Any suggestions??? For anyone who has developed macro systems, how have
you handled temp dataset naming conventions to increase the reliability