The question below is related to the following answer: Solved: Macro error Apparent symbolic reference - SAS Support Communities
I have an example where code similar to below is run and the WARNING: and ERROR: messages similar to the related question are generated. According to the answer to that question "the only way num_obs is not defined is if the the first query returns no results".
However, how should mydata look like, not to generate any value into num_obs and at the same time return no error messages from the proc sql statement.
My log is very sparse, options nonotes turned on, and therefore I have no information about what the data set looked like at the time of running. It is also very difficult for me to rerun the program to regenerate the error, but nevertheless I need to understand what actually happened.
proc sql noprint;
select count(*) into :num_obs
from (select distinct var
from mydata);
quit;
%let num_obs=&num_obs.;
WARNING: Apparent symbolic reference num_obs not resolved.
ERROR: The text expression &num_obs. contains a recursive reference to the macro variable num_obs. The macro variable will be assigned the null value.
BTW: I'm running SAS 9.4 (TS1M6)
... View more