For readability, in a data step you can explicitly name parameters for the hash object declaration, as per SAS(R) 9.2 Language Reference:
declare hash myhash(dataset: "table", duplicate: "r");
In PROC DS2, using the similar syntax produces an error:
proc ds2;
package foo /overwrite=yes;
declare package hash myhash(hashexp: 4);
endpackage;
run;
quit;
ERROR: Compilation error.
ERROR: Parse encountered ':' when expecting ')'.
ERROR: Line 64: Parse failed: declare package hash myhash(hashexp >>> : <<< 4);
I tried using an equals sign instead, like invoking a macro and naming the parameters explicitly, but that doesn't work. I think the `=` is evaluated as part of a boolean equation, passing a 1 or 0 as the value.
Using the package methods to configure the hash might be more readable, but for brevity I'd like to just use the parameters in the constructor. And overall, when creating user-defined packages, some methods might take a bunch of parameters, and it would be tedious and bug-prone to write and call a method to set each parameter.
Here's a DS2 example I think that could use some explicit parameter naming:
declare package hash h1([key1], [data1 data2 data3], 0, 'testdata', '', '', '', 'multidata');
... View more