When I debug, I like to print out small subsets of my datasets at each point. Typing
proc print data=datasetname(obs=20); title ``datasetname''; run; title;just doesn't cut it. The %stdprint macro allows me to avoid this
%macro stdprint(inds, sopt); proc print data=&inds(obs=20); title "&inds : &sopt"; run; title; %mend;I call this by saying
%stdprint(datasetname);
This prints the first 20 observations, together with the dataset name as title. It also allows me to have an optional extra subtitle (&sopt in the macro definition), so I can distinguish different printings of the same dataset.
%comprint does the exact same thing, except that it prints the whole dataset. It is %stdprint without the ``obs=20''.
If you're dealing with large datasets and you have a space constraint, you might want to delete each dataset after you're done with it, so that space in your WORK directory is freed.
One way to do this is to say
proc datasets lib=work nolist; delete datasetname; quit;
The nolist option stops proc datasets from printing a list of members of the work directory to the log file.
This can be replaced by:
%macro dsdel(inds); proc datasets lib=work nolist; delete &inds; quit; %mend;
And the one-liner in open code
%dsdel(useless_dataset);