Hi
I have recently started using macro is sas and I am stuck at this issue. Please help!!
I want the covaraince estimates from proc mixed in sas for around 45 varaibles in my data set. I want to append the results in a final data set and I also want that the final dataset should tell me which varaince components belong to which varaible. So after proc mixed , I am creating a dataset named new to add those varaible name from the macro statement in the data.(VARNAME,and CAT). But actually when I run this macro and print the final results I should have three variance components from each iteration of macro, but actually it has way more than that. I don't understand what I am doing wrong. Please suggest some way out.
Thanks
%MACRO var(DATA, VARNAME,cat);
ods select none;
ods output covparms=Cov_Estimates;
proc mixed data=prep method=type1 cl;
class pt image scanwithinday ;
model &varname=;
random pt scanwithinday(pt);
run;
data new;
set new Cov_Estimates;
retain Vname Category;
call symput ('Vname','&varname' );
call symput ('Category','&cat');
run;
data final;
set final new ;run;
%mend;
data final;stop;
%var(data, varname=vp_dl,cat=Localisation and Distance);
%var(data,varname=vp_dr,cat=Localisation and Distance);
%var(data,varname=dl_dr,cat=Localisation and Distance); ods select all; proc print data=final; run;
... View more