SAS の PROC FCMP を使用して、再コーディング用の関数を作成しています。これらは共有ディレクトリのデータ セットに保存されるため、同僚が使用できます。ほとんどの場合、関数は同じディレクトリ内のルックアップ テーブルをハッシュする単なるラッパーです。
簡単な例:
Libname OurStuff "path/to/shared/data";
DATA OurStuff.foobar;
foo = 1;
bar = 2;
Run;
PROC FCMP outlib = OurStuff.functions.lookup;
Function recode_foo(foo);
Length bar 8;
Declare hash foobar(dataset: "OurStuff.foobar");
rc = foobar.defineKey("foo");
rc = foobar.defineData("bar");
rc = foobar.defineDone();
rc = foobar.find();
Return(bar);
Endsub;
Run;
関数は元の libname で動作します。
Options cmplib = OurStuff.functions;
DATA _NULL_;
result = recode_foo(1);
Put result =;
Run;
しかし、誰かが別の libname を使用すると、次のようにはなりません:
Libname OurStuff clear;
Libname WildName "path/to/shared/data";
Options cmplib = WildName.functions;
/* Results in "ERROR: Libref OURSTUFF is not assigned" */
DATA _NULL_;
result = recode_foo(1);
Run;
全員が同じ libname を使用することを主張する以外に、これらの関数が常に機能することを確認する方法はありますか?