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 (February 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 28 Feb 2005 14:25:19 -0500
Reply-To:   harry.droogendyk@RBC.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Harry Droogendyk <harry.droogendyk@RBC.COM>
Subject:   Re: Avoiding file name collisions in macros
Content-Type:   text/plain; charset=iso-8859-1

Don't specify a dataset name, pick up its name from &syslast for subsequent steps. Of course if multiple datasets are created in the macro and the dataset names must be available outside the macro, you'll have to create multiple macro variables and then contend with the local/global issues.

data ; a = 'asdf'; run;

proc print data=&syslast; run;

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Curt Seeliger Sent: Monday, February 28, 2005 1:57 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Avoiding file name collisions in macros

Folks,

How are you avoiding data file name collisions in macros?

In days of yore, when my macros ran only one deep, I got away with prepending the temporary file names with a couple underscores '__'. These days, with macro calls often running several deep, I find myself getting bit on occasion, making for some unnecesarily bothersome debugging sessions. I could, given the time, simply add the name of the macro which creates the temporary file name to that file name, a la:

%MACRO one; data __oneTemp; .... %MEND one;

%MACRO two; data __twoTemp; .... %MEND two;

%MACRO three; %one; data __threeTemp;.... %two; %MEND three;

There's gotta be more elegant solutions though. Anyone?

cur -- Curt Seeliger, Data Ranger CSC, EPA/WED contractor 541/754-4638 seeliger.curt@epa.gov

------------------------------------------------------------

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

============================================================


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