|
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/
|