Hi Rezza,
Thanks so much.
I'm a little confused how this works
proc means data=sashelp.class stackods n qrange p1 p99; var weight height; ods output summary=ranges; run;
*create data with outliers to check; I have millions of observations and Hundreds of variables I cant do this check for each observation data capped; set sashelp.class; if name='Alfred' then weight=220; if name='Jane' then height=-30; run;
*macro to cap outliers;
Where do I input the variable list?
%macro cap(dset=,var=, lower=, upper=);
data &dset; set &dset; if &var>&upper then &var=&upper; if &var<&lower then &var=&lower; run;
%mend;
Is the syntax I need to add look like this?
%cap(daset=have var=list of vars lower=P1 upper=P99);
*create cutoffs and execute macro for each variable; data cutoffs; set ranges; lower=p1; upper=p99; string = catt('%cap(dset=capped, var=', variable, ", lower=", lower, ", upper=", upper ,");"); call execute(string); run;
... View more