Using DATA _NULL_ When Creating Reports - SAS Programming

If you only need to create a SAS data set to produce a report using PUT statements,use DATA_NULL_instead of creating a real SAS data set.When you use DATA_NULL_, the SAS System processes the observations but does not invoke the overhead of actually creating a new data set.

Example– INEFFICIENT

DATA UNNECESS;
FILE PRINT;
SET OLD;
IF AGE GT 50 THEN PUT ID= AGE=;
RUN;

Here you use a DATA step to put the data out without the need for a PROC PRINT. You only need to see those observations where age is greater than 50, so you use an IF statement to create a subset of data to process.You can achieve the same results without creating the unnecessary data set UNNECESS as follows:

Example-EFFICIENT

DATA _NULL_;
FILE PRiNT;
SET OLD;
IF AGE GT 50 THEN PUT ID= AGE=;
RUN;

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

SAS Programming Topics