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 (October 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 19 Oct 2007 07:21:57 -0400
Reply-To:   "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Organization:   Internet News Service
Subject:   Re: Overriding LIBNAME and FILENAME statements
Comments:   To: sas-l@uga.edu

nancynpaul-sasl@yahoo.com wrote: > But of course this does not work since the filename in production.sas > reassigns the filename to the original production location. > > Is there a technique that I can use to override the filename in this > situation? > > Paul OldenKamp

You are not really overriding, you are attempting to prevent overriding. It would be nice for you if there were a no 'NOREASSIGN' filename option: FILENAME myFile "where-ever" ONREASSIGN=(Allow|Note|Warn|Error); But there ain't.

One way to prevent the production code from reassigning lib refs is to lock them. You _will_ get an ERROR when the production code does try to reassign -- which, depending on session option settings, might cause the session to abend or go into error check mode.

How do you lock a libname ? Open a resource and never close it.

-------------------- %let work = %sysfunc(pathname(work));

data _null_; dir1 = dcreate ('foo-prod', "&work."); dir2 = dcreate ('foo-dev', "&work."); run;

* create and open a resource; libname foo "&work.\foo-dev"; data foo.tag; run; %let ds = %sysfunc(open(foo.tag));

* try to change the libref; libname foo "&work.\foo-prod"; --------------------

This idea does not work for filerefs. When a fileref is locked it cannot be 'used' in a separate step (post failure of production code to reassign it).

The best approach is to have a development environment, or design the production code to run off parameters passed into it.

Richard A. DeVenezia http://www.devenezia.com/


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