*
;

              options nosource;
%macro smooth(data,result,x,y,points,method);

/*written by Arnold Schick, University of Marburg, Germany*/

 options nomprint nosymbolgen nonotes nostimer;

 %if &data   = . or &data   =  %then %let data   = _LAST_;
 %if &result = . or &result =  %then %let result = _NEW_;
 %if &points = . or &points =  %then %let points = 250;
 %if &x = . or &x =  %then %let x=x;
 %if &y = . or &y =  %then %let y=y;
 %if &method = %str( ) or &method = %str(.)
   %then %let m = %str(;);
   %else %do;
      %let L = %eval(%length(&method)-2);
      %let m = %substr(&method,2,&L);
   %end;

 data _in_;
   set &data;
  _z_=1;
 run;

 proc g3grid data=_in_ out=&result;
   grid &x*_z_=&y /naxis1=&points naxis2=1 join &m;
 run;

 proc datasets nolist; delete _in_; run;
 options notes;
 data &result;
   set &result;
   drop _z_;
 run;

 options stimer ;
%mend smooth; options source;

*Example;
/*
data one;
  do x=-10 to 10 by 0.375;
     if x > -1 and x < 0 then y=.; else y=sin(x);
     output;
   end;
run;

%smooth(one, two, x, y, 1001, "spline");

proc gplot;
 symbol i=none v=point ;
 plot y*x / nolegend ;
run; quit;
*/

*
;