The "if 0" is an if test that will always fail, so the statement
if 0 then set have;
means that this statement will NEVER actually read data from have.
But even though data is not actually transcribed from have via this statement, the sas compiler still sees the "set have", and consequently expands the program data vector (PDV) to include all variables in the have dataset. The reason this is needed is because the subsequent "declare hash h (dataset:'have',hashexp:20)" is NOT similarly used by the sas compiler to expand the pdv.
Consider this program, which looks up the data for "Alfred" in the hash object h.
data _null_;
*if 0 then set sashelp.class;
declare hash h (dataset:'sashelp.class');
h.definekey('name');
h.definedata(all:'Y');
h.definedone();
name='Alfred';
rc=h.find();
put (_all_) (=);
run;
It generates an error message in the log:
ERROR: Undeclared data symbol Sex for hash object at line 290 column 5.
ERROR: DATA STEP Component Object failure. Aborted during the EXECUTION phase.
which simply means that even though there is data for a variable named SEX in the hash object, there is no variable named SEX in the pdv, So the FIND method, which is intended to transfer data from the hash object to the pdv, fails.
Now try the same program, but de-comment the "if 0 then ..." statement.
... View more