sorry, this is the code I used. The proc mixed is in this code. I resticted the variables to just age and female but I need to run the code across a large number of variables. Many thanks
%macro loop(var);
data pv1_&var;
format y $20.;
y='';
run;
%let endpoint=ln_lvesv_rep ecv_rem_rep;
%do i=1 %to 2;
%let y=%scan(&endpoint,&i,' ');
title "Endpoint = &y";
ODS OUTPUT SOLUTIONF=RESULTS;
proc mixed data=longformat_stemi covtest noclprint plots=studentpanel method=reml;
class patient_id site_id;
model0: model &y = drug &var drug*&var/ s cl ddfm=kenwardroger;
repeated / type=un subject=patient_id r;
run;
DATA pv1_&var;
SET pv1_&var RESULTS(IN=A);
if missing(effect) then delete;
IF A THEN Y="&y";
RUN;
%end;
title " ";
%mend;
%macro lst(dsn);
/** open dataset **/
%let dsid=%sysfunc(open(&dsn));
/** cnt will contain the number of variables in the dataset passed in **/
%let cnt=%sysfunc(attrn(&dsid,nvars));
%do j = 1 %to &cnt;
%loop(%sysfunc(varname(&dsid,&j)))
%end;
%mend lst;
/** Sample data set **/
data test2; set longformat_stemi;
keep
age female
;
run;
%lst(test2)
... View more