| 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 |
|
| In-Reply-To: | <200705222121.l4MG3LlX021523@mailgw.cc.uga.edu> |
| Content-Type: | text/plain; charset="us-ascii" |
Paul,
I wrote a paper for the Forum on the topic. See
http://www2.sas.com/proceedings/forum2007/047-2007.pdf
Ed
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
mailto:EdHeaton@Westat.com http://www.Westat.com
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Paul Walker
Sent: Tuesday, May 22, 2007 5:22 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Work Library Files for a Macro System
Hello SAS-L,
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
create
temp datasets which are then deleted at the conclusion of the macro.
But
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:
[1] Name all the temp datasets with a prefix according to the name of
the
macro
[2] Add a timestamp (date+time) integer to the dataset name
[3] Put error checking logic into the macro so that it only runs if the
datasets which it will create do not already exist
[4] 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
of
the system?
- Paul
|