I need to store in a macro variable the number of rows in a data set. So I used this:
%macro get_table_size(inset,macvar);
data _null_;
set &inset NOBS=size;
call symput("&macvar",size);
stop;
run;
%mend;
%get_table_size(LOANTAPE.INSTRUMENT_VU21,NUM_REG_INS);
%put &NUM_REG_INS;
Before my computer crashed (having to force it to reboot with SAS opened), this worked (I swear xd). But now, the macro NUM_REG_INS is not created. The log says: Apparent symbolic reference MACVAR not resolved.
So I checked the code as a data step and not a macro, like this:
data _null_;
set LOANTAPE.INSTRUMENT_VU21 NOBS=size;
call symput("macvar",size);
stop;
run;
%put &macvar
And it works. So the problem is when using this code inside a macro. Does anybody knows what could be happening here and how to fix it? And, just for the sake of curiosity, why was it working before?
Thank you, really!!