Category: | Special Purpose Functions |
Notes: | LIMMOMENT is a special purpose function that is automatically
provided by the FCMP procedure for your convenience.
If you specify order k and upper limit u, then the LIMMOMENT function computes the limited moment as E[min(X,u)k], where E denotes an expectation taken over the distribution of a random variable X that is defined by the specified CDF function. |
function <CDF-function-name> (x, parameter-1, parameter-2, …, parameter-n);
endsub;
proc fcmp library=work.mycdf outlib=work.mylimmom.functions; function logn_limmoment(order, limit, mu, sigma, rc); outargs rc; array opts[4] / nosym (1.0e-8 . . .); m = limmoment("logn_cdf", opts, order, limit, mu, sigma); rc = opts[4]; /* return code */ return (m); endsub; quit;
proc fcmp outlib=work.mycdf.functions;
function logn_cdf(x, Mu, Sigma);
if (x >= constant('MACEPS')) then do;
z = (log(x) - Mu)/Sigma;
return (CDF('NORMAL', z));
end;
return (0);
endsub;
quit;