sas macro - SAS code behaves differently in interactive and batch modes -


i have following code running inside macro. when run in interactive mode, runs absolutely fine, no errors or warning. case last 2 year.

the same code has been deployed in batch mode , generates warning warning: apparent symbolic reference firstreccount not resolved. , no value assigned macro variable.

my question is, have ideas why batch mode , interactive mode behave differently?

here more information:

  1. the dataset being created , in work library.

  2. the dataset opened data step.

  3. `firstreccount' doesn't initialiased anywhere else in program
  4. i have search sas community. there topic here, don't have same errors in batch initilisation described in answer.
  5. detailed information on warning doesn't explain work in interactive mode, not in batch mode.

.

1735        %let firstset = work.dataset1;  1744        data _null_; 1745            if 0 1746                set &firstset nobs=x; 1747            call symput('firstreccount' ,x); 1748            stop; 1749        run;         1755        data _null_; 1756            if 0 1757                set &secondset nobs=x; 1758            call symput('secondrecount' ,x); 1759            stop; 1760        run; warning: apparent symbolic reference firstreccount not resolved. 

update:

so have attempted replicate error copying code warning separate scheduled flow, didn't cause errors @ all.

by way, original job deployed sas di studio. have checked lines in user written code nodes , made sure length within 80 characters recommended @rawfocus, @robertpentridge, didn't solve issue. recomended @data_null_ have checked validvarname , different between interactive (value of "any") , batch mode (value of "v7") changing these hasn't made difference.

i have rewritted logic number of observations calling attr open dataset. eliminated warning, program still fail warning popping out in different places. made me think robert partridge correct. @ same time, got error macro not being resolved. macro inserted di studio collect performance mi job wasn't meant collecting mi. made me think sas di studio not generating code correctly when deploying it, manually edited deployed code remove offending macro call , spotted there 1 line of code md5 function long on 1 line because of number of parameters being passed it, inserted white space. , problem fixed!!

i still need job because when redeployed sas di, generate same errors again. don't have time further @ moment.

conclusion: write in sas di , gets deployed different cause syntax parse throw errors in random places. mark robert's answer correct because got me closer solving problem other answer.

the problem happening above code snippet pasted. parser got funk earlier, , ended issuing warning code fine.

check make sure no code within macro longer ~160 chars on single line. try keep code below long lines of code can run fine interactively , fail in batch - particularly when inside of macro.


Comments