Return to Archive

SAS Tip of the Month
June 2006

When people look at SAS code, they will occasionally see the following first line of at datastep:

   DATA _NULL_;

This does not create a dataset call _NULL_, but instead runs the datastep without creating a dataset. Why would we want to do this? Not every datastep we run in a SAS program needs to create a dataset - most of the time it will be to get information from a dataset, but there are occasions where some temporary data just needs to be generated for the datastep that is only used for that step. The following example shows an example where we get the number of observations from the dataset SASHELP.CLASS and transfers that number to a macro variable:

   data _null_;
      if 0 then set SASHELP.CLASS nobs=nobs;
      call symput('num',trim(left(put(nobs,8.))));
      stop;
   run;
________________________________
Updated June 1, 2006