Hi! Thanks in advance for your help!
I have two data sets(Base and Sheet1). They have a common key, let's say "ID". I want to create a "flag" = 1 in Sheet1 if ID from Sheet1 is shown in Base and flag = 0 otherwise. I did this following the code below:
data temp1;
if _N_ = 1 then do;
declare hash VET(dataset: 'Base');
VET.definekey('org');
VET.definedone();
end;
set Sheet1;
FLAG = VET.check();
run;
This works perfectly fast. However, I have many "Sheet1", let's say Shee1 - Sheet300 (I ran a macro to read those 300 files to the library.work). I want to perform the same procedure on them. So I wrote a macro:
%macro csv(howmany);
%do i = 1 %to &howmany;
data temp&i;
%if _N_ = 1 %then %do;
declare hash VET(dataset: 'Base');
VET.definekey('org');
VET.definedone();
%end;
set Sheet&i;
FLAG = VET.check('org');
run;
%end;
%mend csv;
Then I ran into an error. It says:
ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase.
ERROR 557-185: Variable VET is not an object.
Can anyone help?
After this step, I want to stack/append (proc append) those observations with Flag =1. I imagine this will take much of the space since we read them in and store them. Any more efficient way?
Thanks,