Hi can you help. My sas macro is not resolving a value but i'm not sure why. Can you have a look? error log attached. Regards Rob OPTIONS symbolgen mlogic mprint ; %let paramfile = \\Essentsvr\saas\Development RR\CIRT-ACIS Parameter File 20180912 (TG - ACIS working).xlsm; %macro getinfile(fileloc, tab); PROC IMPORT OUT=&tab DATAFILE= "&fileloc" DBMS=EXCEL REPLACE ; GETNAMES=YES; Sheet="&tab"; MIXED=NO; SCANTEXT=YES; USEDATE=YES; SCANTIME=YES; RUN; %mend ; %macro assignmacros(tabdseti,type); %PUT "Running Macro: assignmacros (tabdseti=&tabdseti.,type=&type.)"; *%global nvars nobs; %if &type ne ACIS_B %then %do; %getinfile(¶mfile, &tabdseti) ; %let tabdsid=%sysfunc(open(&tabdseti)); %let nvars=%sysfunc(attrn(&tabdsid,nvars)); %let nobs=%sysfunc(attrn(&tabdsid,nlobs)); * var1-varn will define the field names; %do i=1 %to &nvars; %let var&i=%sysfunc(varname(&tabdsid,&i)); %end; %let close=%sysfunc(close(&tabdsid)); * for example if reading tab "Input Fields CS CIRT Setup Data" for var1=reference this will create a macro name reference1-reference(nobs) var2 field1-field(nobs) etc; data _null_; set &tabdseti; %do i=1 %to &nvars; %do j=1 %to &nobs; %global &&var&i..&j; %end; %end; run; proc sql noprint; %do i=1 %to &nvars; select &&var&i into :&&var&i..1-:&&var&i..&nobs from &tabdseti; %end; quit; * this bit assigns the value to the macro variables so that the program knows that say CS01_field=poolid CS_01_format=$16. etc; %do i=1 %to &nobs; %global &&&var1.&i &&&var2.&i; %let &&&var1.&i=&&&var2.&i; /*%if %length(&&&var3.&i)>0 %then %do; %global &&&var3.&i; %let &&var2.&i=&&&var3.&i; %end; %if %length(&&&var4.&i)>0 %then %do; %global &&&var4.&i; %let &&var3.&i=&&&var4.&i; %end; %if %length(&&&var5.&i)>0 %then %do; %global &&&var5.&i; %let &&var4.&i=&&&var5.&i; %end;*/ %end; %end; %else %do nextinp=0 %to 3; %let k = %scan(20 50 51, &nextinp); %getinfile(¶mfile, &tabdseti.&k) ; %let tabdsid&k=%sysfunc(open(&tabdseti&k)); %let nvars_RT&k=%sysfunc(attrn(&&tabdsid&k,nvars)); %let nobs_RT&k=%sysfunc(attrn(&&tabdsid&k,nlobs)); * var1-varn will define the field names; %do i=1 %to &&nvars_RT&k; %let var&k&i=%sysfunc(varname(&&tabdsid&k,&i)); %end; %end% %let close=%sysfunc(close(&&tabdsid&k)); %mend; %assignmacros(Pre_AS_Inpt_Flds_ACIS_SUp_RT,ACIS_B);
... View more