At any point in the data step you can say
put <variable-list>
and the observations of the variables in variable-list will be written to the log. You can also use this in a conditional:
data msf;
set crsp.msf(obs=200);
if permno>10006 then put permno date ret;
run;
The ``obs=200'' is so that my log file does not get huge.