put _ALL_

Reply
Contributor
Posts: 29

put _ALL_

Hi,

I am using the put _ALL_ statement to print results from a data step in the SAS log, but my output is too large. How can I suppress the put statement to only print a specified number in the SAS log (e.g. 50, 100 lines, etc.).

Thanks.

Super User
Posts: 11,343

Re: put _ALL_

The dataset options Firstobs and Obs may help.

To print starting at the 50th record and print 100 lines

data _null_;

     set have (firstobs=50 obs=149);

     put _all_;

run;

You might want to try using File Print to send the output and/ or current ods destination.

Super User
Posts: 5,498

Re: put _ALL_

In most DATA steps, you could use this:

if _n_ < 50 then put _all_;

There are complications if your DATA step deletes some of the observations, but this would be the general idea.

Super User
Super User
Posts: 7,039

Re: put _ALL_

Use the MOD() function on the observation counter.

if mod(_n_,50) = 1 then put (_n_ _all_) (=);

You might want to change the interval based on the size of the input dataset.

...

set x nobs=nobs ;

...

if mod(_n_,int(nobs/100)) = 1 then put (_n_ _all_) (=);

...

Ask a Question
Discussion stats
  • 3 replies
  • 1674 views
  • 0 likes
  • 4 in conversation