1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| proc import
datafile="C:/Program Files/R/fichierdata.txt"
out=fichierdata dbms=tab
REPLACE;
getnames=yes;
proc import
datafile="C:/Program Files/R/fichierinfo.txt"
out=fichierinfo dbms=tab
REPLACE;
getnames=yes;
proc SQL;
DELETE FROM fichierdata
WHERE (obs=. OR incl=0);
run;
proc sort DATA=fichierdata;
BY Method Lab Assay Rep Prep Dose Block Row Obs Incl;
run;
proc sort DATA=fichierinfo;
BY Method Lab Assay Rep Prep Assigned mg ml Dilstep;
run;
proc sql;
CREATE TABLE cle AS
SELECT Method,Lab,Assay,Rep
FROM fichierdata
GROUP BY Method,Lab,Assay,Rep;
quit;
%macro ma_macro(Method,Lab,Assay,Rep);
DATA fichierdata;
SET fichierdata;
cDose=Dose;
proc glm DATA=fichierdata;
class prep cdose block row;
model Obs= Block Row Prep Dose Dose(Prep) Dose*Dose cDose*Prep /ss1;
ods output OverallAnova=OverallAnova ModelAnova=ModelAnova;
run;
DATA Anova(keep = Source df SS ms Fvalue Probf);
retain dfLin ssLin;
SET ModelAnova OverallAnova;
IF df>0 then output;
IF source='Dose*Dose' then do; dfLin=df; ssLin=SS; end;
IF source='Prep*cDose' then do; dfLin=dfLin+df; ssLin=ssLin+SS; end;
IF source='Error' then do; source='Non-Linearity'; Fvalue=(ssLin/dfLin)/ms; probf=1-Probf(Fvalue,dfLin,df); ss=ssLin; df=dfLin; ms=ss/df;
IF df>0 then output;
end;
ods SELECT ALL;
proc print DATA=Anova noobs;
run;
%MEND;
DATA _null_;
SET cle;
call execute( '%ma_macro('||Method||','||Lab||','||Assay||','||Rep||')' );
run; |
Partager