do until(eof);
set class end=eof;
if z.find(key:name,key:zipcode)=0 and c.find(key:zipcode)=0;
end;
stop;
Since there is no OUTPUT statement in your loop, and the STOP statement terminates the data step before the implicit output is done, nothing is written to the dataset.
Use the "natural loop" of the data step instead:
data need(keep=name zipcode city department);
set class;
if 0 then set zipcodes cities;
if _n_=1 then do;
length zipcode 8 city department $30;
dcl hash z(dataset:'zipcodes');
z.definekey('name');
z.definedata('zipcode');
z.definedone();
dcl hash c(dataset:'cities');
c.definekey('zipcode');
c.definedata('city','department');
c.definedone();
end;
if z.find()=0;
if c.find()=0;
run;
Note that I adapted the hash definitions, as dataset class does not have a zipcode variable. Therefore it is also necessary to split the subsetting IFs, to make sure that the second FIND() is executed after the first one that retrieves the zipcode.
The code is not tested in any way, as I am posting from my tablet.
... View more