- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Data sales; Input dept: $10. Jan feb mar; Datlines; Shoes 4344 355 266 Houseware 33 44 55 ; Data _null_; Set sales; qtrTot = jan + feb + mar; put ‘total quarterly sales: ‘ qtrtot dollar12.: Run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If _NULL_ is specified as the data set name, SAS does not create a data set when it executes the DAT...
Follow the link for more information
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In the present scenario it does not create any new dataset.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is its result used in another statement?
Is it save in memory for further use?
Regards,
Blue Blue
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since no data step is created no disk space is needed,
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It can be used when you want to use data step logic/processing to either create code (call execute), create macro variables (call symputx), or write to an external tex file (file) without also creating a data set.
There are other uses, but those are some of the most common.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If _NULL_ is specified as the data set name, SAS does not create a data set when it executes the DAT...
Follow the link for more information
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The data _null_ allows you use SAS coding in data step that does not require creating a new data set.
Expensive pocket calculator:
Data _null_; x = 1 + 2 + 3 + 4 + 5; put x= ; run;
Puts the result to the log
Write to the results window:
Data _null_; file print; x = 1 + 2 + 3 + 4 + 5; put x= ; run;
Write to an external file:
Data _null_; file "c:\folder\sometextfile.txt"; x = 1 + 2 + 3 + 4 + 5; put x= ; run;
With data on a SET statement then you can write any of that out, such as create custom file layout that Proc Print wouldn't. 30 years ago I worked for an agency that used this approach to write text markup that our fancy (read big as car) high production laser printer used to make "nice" tables and graphics that we called "Proc AnnualReport".
This usage has been expanded with the File ODS and/ or the Report writing interface.
Create macro variables with Call symputx/symput.
Create calls to Call Execute that stacks code into the execution buffer for execution after the data step terminates.
Make noise (I used to use this to tell me when some longish running jobs were finished )
data _null_; call sound(523,2000); run;
Generally do something that does not require creating an output data set when you want to use data or fixed elements of coding.