SAS logging

I know what I can use %PUT

to write a text string to the log window, but what if I want to log the result of a function, for example PROBNORM(x)

? Is there a way to do this?

+3


source to share


2 answers


Use %sysfunc()

to evaluate the function during macro resolution.

IE



%let x=1;
%put %sysfunc(probnorm(&x));

      

+5


source


In the data step, the PUT and PUTLOG functions will be logged using the data step variables. You cannot use a function directly, but if you assign a value to a variable, you can write that variable.

data _null_;
 x=1;
 y = probnorm(x);
 put "Probnorm is " y=;
run;

      



While you can do this with% PUT and% SYSFUNC, they have a significant limitation in that they cannot access data step variables (without a lot of work).

+4


source







All Articles