Thank you, this makes sense. I am just having a small issue when I call the macro and define the variables. I get this error, "ERROR: The keyword parameter INPUT was not defined with the macro. ERROR: The keyword parameter VAR was not defined with the macro. ERROR: The keyword parameter OUTPUT was not defined with the macro." I think I'm likely calling it incorrectly. This is my modified code (not all variables are represented here, just a portion): %let variablenames=weight height totalfat totalmass totallean;
%macro identify_outliers(variablenames=,datasetname=);
proc summary data=&datasetname;
var &variablenames;
output out=stats qrange= mean=/autoname;
run;
%do i=1 %to %sysfunc(countw(&variablenames));
%let thisname=%scan(&variablenames,&i,%str( ));
data outliers_&thisname;
if _n_=1 then set stats;
set &datasetname;
if &thisname>(&thisname._mean + 3*&thisname._qrange) then do;
variable=&thisname;
value=put(&thisname, 10.);
issue='Out of range';
end;
run;
%end;
%mend; %identify_outliers(input=alldxa, var=&variablenames, output=outliers);
... View more