User981636
User981636

Reputation: 3621

SAS Print a value in the log

I just want to print the output of a simple operation to the SAS log.

For instance, how can I see the value of quantile('T', .75, 1000)? Is there a smarter way to check what does quantile('T', .75, 1000) equal to than printing it to the log?

%let t_value = quantile('T', .75, 1000); 
%put &t_value.;

Others use a proc procedure as here but I cannot believe I need to create a data set to check a value...

Upvotes: 1

Views: 6029

Answers (2)

Reeza
Reeza

Reputation: 21264

You don't need to create a data set, but another option is a data step with the _null_ data set.

data _null_;
x = quantile('T', 0.75, 1000);
put x; 
run;

Upvotes: 2

Richard
Richard

Reputation: 27498

Use the macro function %SYSFUNC to invoke non-macro (i.e. DATA step) functions in macro.

Example:

%put NOTE: quantile('T', .75, 1000) is %SYSFUNC(quantile(T, .75, 1000));

will log

11854  %put NOTE: quantile('T', .75, 1000) is %SYSFUNC(quantile(T, .75, 1000));
NOTE: quantile('T', .75, 1000) is 0.67473516460692

Tip: Literal arguments you might use in DATA step do not need to be so in %SYSFUNC invocations. Carefully examine %SYSFUNC(quantile(T, .75, 1000))

Upvotes: 3

Related Questions