%macro sum_glm(version, /************************ REQUIRED parameters **************************/ N= , /* Name of the variable containing the frequency counts */ /* of the individual groups. */ Mean= , /* Name of the variable containing the means of the */ /* individual groups. */ StdDev= , /* Name of variable containing the standard deviations */ /* of the individual groups. */ Group= , /* Name of the classification (grouping) variable. */ /************************ OPTIONAL parameter ***************************/ Data=_last_ , /* Name of the SAS data set containing the summary */ /* statistics. If this parameter is not specified, */ /* the last created dataset will be used. */ LSopts = , /* Any option(s) that are desired on the LSMEANS */ /* statement. */ By = /* By variable(s). */ ); %if &version ne %then %put SUM_GLM macro Version 1.1; %let opts = _last_=%sysfunc(getoption(_last_)); %if &data=_last_ %then %let data=&syslast; title 'SUM_GLM Macro: Analysis of Variance on Summary Statistics'; /* Create data based on summary statistics */ data _working; set &data; Xis = &Mean + sqrt((&StdDev**2)/&N); Xns = &N*&Mean - (&N-1)*Xis; y=Xis; Freq=&N-1; output; y=Xns; Freq=1; output; run; proc glm data=_working; by &By; class &Group; freq Freq; model y = &Group; lsmeans &Group / &LSopts; run; quit; options &opts; title; %mend;