Yeah, sorry about that. Needed to edit the code first so that it was english only:
%Macro Load_table(ds,ar1,ar5,ar15);
Data data_&ds;
set sashelp.vmember(keep = memname libname
where=( libname='DUMMY' AND
Substr(Memname,1,length("&ds"))=upcase("&ds") AND
((Length(Memname) = length("&ds")+2 AND Length(Memname)>3) OR
(Substr(Memname,1,length("&ds"))='P' AND (Length(Memname) = length("&ds")+4))) AND
notdigit(substr(memname,length(memname)-1,2))=0));
Year = Substr(memname, length(memname)-1,2);
If Year <= '69' Then
year_num = Input(Compress("20"||Year),best4.);
If Year >='70' Then
year_num = Input(Compress("19"||Year),best4.);
Year_d1 = &ar1;
Year_d5 = &ar5;
Year_d15 = &ar15;
Drop libname;
run;
%If &ds^=p %Then
%Do;
Proc sql;
select max(year_num) into: Max_&ds
from data_&ds
;quit;
Data data1_&ds(keep= Memname year_num Max_ds Flag
where=( year_num = Max_ds OR
Flag=1));
set data_&ds;
Max_ds = &&Max_&ds; /*####### THIS part works but still get a resolve-error###########*/
Output;
If Year_d1 ^=. then do;
Do i=1 to &ar1;
If year_num = Max_ds-i then flag=1;
Else Flag = 0;
Output;
End;
End;
If Year_d5 ^=. then do;
Do i=1 to &ar5;
j=5*i;
If Substr(year,2,1) in('0','5') and year_num>= 2011-j then flag=1;
Else Flag = 0;
Output;
End;
End;
If Year_d15 ^=. then do;
Do i=1 to &ar15;
j=15*i;
If year_num = Max_ds-j-1 then flag=1;
Else Flag = 0;
Output;
End;
End;
If _N_ = 1 then do;
Call symputx('Max_master',Max_ds);
End;
run;
Proc sort data=data1_&ds(keep=Memname year_num) nodupkey;
by Memname year_num;
run;
Data _null_;
set data1_&ds;
ds="&ds";
Call Execute('%Merge('||Memname||','||Year_num||','||ds||')');
run;
%End;
%Mend %Load_table;
Data _null_;
set ani.infile_atabs(where= (id="&atab"));
If T2='' then do;
Call Execute('%Load_table('||T1||','||AR1||','||AR5||','||AR15||')');
End;
Run;
The last macro merge isn't included but the things that happen there have no influnce on the result. I have marked the "false" error with: /*####### THIS part works but still get a resolve-error###########*/
... View more