I have a number of variables that were log transformed, and I wanted to use these new variables to do ANOVA.
I first created a macro variable to store all the log transformed variables names and then used a do loop to repeat the anova analysis.
The problem is, my last log variables was not included in the anova analysis. I checked the values of the macro variables "collist" and "n", which were both correct.
What could be the problem?
%macro loop_var(data);
proc contents data=&data short out=test; run;
proc sql;
select name into :collist separated by ' '
from test
where name like 'log_%';
%let n=&sqlobs;
quit;
ods graphics off;
%do i=1 %to &n;
%let currentvar=%scan(&collist,&i);
proc glm data=&data ;
class type;
model ¤tvar=type;
lsmeans type /pdiff stderr cl ADJUST=SCHEFFE;
%end;
%mend;
%loop_var(mydata);
Try adding
run;
at the end of the Proc Glm code. You may not be running into a "boundary" to tell the procedure that the last one ended.
What values do you have for collist and n?
Perhaps add:
%put collist=&collist i=&i currentvar=¤tvar n=&n;
Immediately before your PROC GLM statement. That should help debug.
Try adding
run;
at the end of the Proc Glm code. You may not be running into a "boundary" to tell the procedure that the last one ended.
yes. this solved the problem. Thank you.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.