Hi! I'm new to SAS, but I need to run a lot of two-way ANOVAs and store the statistics information in a format that I can easily access later. I have two categorical independent variables, Gender and Treatment, and for this sample I have ~470 different continuous dependent variables, where each variable is a gene ID (for example A0A011V3B7) called Y_1-Y_470 here for ease of typing. I can successfully output each individual result with: proc anova data=data_red;
class Gender Treatment
model Y_1 = Gender Treatment Gender*Treatment /*repeat with Y_2, Y_3, etc.*/
run; But I don't relish doing this 470 times, and was hoping for help in automating the process to make SAS do it for me. I found a couple posts similar to what I want to do and have tried to combine/modify them to suit my needs. Here is what I've attempted: proc sql noprint;
select distinct NAME into : namelist separated by ' ' from anova_vars; /*retrieve variable names into a macro variable*/
quit;
%macro runAnvoa(DSName, nameList);
%local i next_name;
%let i=1;
%do %while (%scan(&namelist, &i) ne);
%let next_name = %scan(&namelist, &i);
proc anova data=data_red outstat=PE(rename=(&namelist=Value)); /*trying to name each model with the gene name*/
class Gender Treatment;
model next_name = Gender Treatment Gender*Treatment;
quit;
proc append base=outStats data=PE;
run;
%end;
%runanvoa(data_red, &namelist);
/*if above works look at output statistics:*/
proc print outStats;
run; This gives me an error about quoted strings, but I'm not using quotes at all. I've included the log file from my run. Any help to get this working (or a more efficient way to do it) would be greatly appreciated! Thanks!
... View more