The simple solution is to skip the %if stuff and just define ymin from ymin1/2:
%let ymin = %sysfunc(min(&ymin1,&ymin2));
The specific syntax error you have, other than a missing ) in the first ymin declaration, is that %let ymin = ymin2;
should be %let ymin=&ymin2;
. Otherwise it just contains the text "ymin2", not the contents of the macro variable.
The entire macro:
%MACRO min(minresult,maxresult,min,max);
%LET ymin1 = %SYSEVALF(&minresult - (((&minresult + &maxresult)/2) * .05));
%PUT ymin1 = &ymin1;
%LET ymin2 = %SYSEVALF(&min - (&min * .05));
%PUT ymin2 = &ymin2;
%let ymin = %sysfunc(min(&ymin1,&ymin2));
%PUT ymin = &ymin;
%MEND min;
%min (5,6,3,4);