SAS Macro coding

后端 未结 3 1489
夕颜
夕颜 2021-01-16 15:54

I dont understand what is going on in my SAS code. The code behaves as expected, but only during the first time it compiles, i.e. the table called \'SummaryTable\' shows the

3条回答
  •  天涯浪人
    2021-01-16 16:17

    I think you're running into issue's with how call execute is working and when the macro variables are resolving. My reasoning for that is if you call the macro individually via %ModelsSummary(..) the error does not occur. I don't know why it's occurring and hopefully someone has a better response for you. A workaround is to use unique macro variables, i.e. add &count at the end of MyLogLik macro variable.

    %macro ModelsSummary(Count,Var,Param);
       proc sql;
    
       select _LNLIKE_ into :MyLogLik&count from parameters&Count;
    
       insert into SummaryTable (ModelNumber,ModelVariables,NumParameters, LogLik) values (&Count,"&Var",&Param, &&MyLogLik&count);
    
       drop table parameters&Count;
    
    
       quit;
    %mend;
    

提交回复
热议问题