Help using Base SAS procedures

How to use functions defined in PROC FCMP ?

Reply
New Contributor
Posts: 3

How to use functions defined in PROC FCMP ?

PROC FCMP is also usefull to test user-defined functions

proc fcmp outlib=work.funcs.temp;

   function a(liczba, zbior

  • ) varargs;
  •     flaga=0;

        length=dim(zbior);

        array z[1]/nosymbols;

        call DYNAMIC_ARRAY(z,length);

             do i=1 to length;

                  z=zbior-liczba;       

                  if z>0 and flaga=0 then

                        do;

                            wynik=zbior;

                            flaga=1;

                        end;

                   if z>0 and zbior<wynik then wynik=zbior;

             end;

        return (wynik);

       endsub;

       file log;

       b=a(1,2,3,5);

       put b;

    quit;

    But the same syntax in DATA step does not work

    option cmplib=work.funcs;

    data _null_;

       b=a(1,2,3,5);

       put b;

    run;

    Is this possible to omit this problem and use functions in the same way (without declare temporary array) ?

    Ask a Question
    Discussion stats
    • 0 replies
    • 113 views
    • 0 likes
    • 1 in conversation