In singlethreaded environments, you always need free
disk space that equals three to four times the data set size. For
example, if your data set takes up 1MB of disk space, you need 3
to 4MB of disk space to complete the sort.
In multithreaded environments,
if you use the OVERWRITE option in the PROC SORT statement, you need
space equal to the data set size. If you do not specify the OVERWRITE
option, the space that you need is equal to two times the data set
size. For more information about the OVERWRITE option, see the “Sort
Procedure” in the Base SAS Procedures Guide.
To estimate the amount
of disk space that is needed for a SAS data set:

create a dummy SAS data
set that contains one observation and the variables that you need

run the CONTENTS procedure
using the dummy data set

determine the data set
size by performing simple math using information from the CONTENTS
procedure output.
For example, for a data
set that has one character variable and four numeric variables, you
would submit the following statements:
data oranges;
input variety $ flavor texture looks;
total=flavor+texture+looks;
datalines;
navel 9 8 6
;
proc contents data=oranges;
title 'Example for Calculating Data Set Size';
run;
These statements generate
the output shown in the following output:
Example for Calculating Data Set Size with PROC CONTENTS
Example for Calculating Data Set Size 1
19:39 Wednesday, February 12, 2003
The CONTENTS Procedure
Data Set Name WORK.ORANGES Observations 1
Member Type DATA Variables 5
Engine V9 Indexes 0
Created Wednesday, October Observation Length 40
3, 2007 07:41:04
Last Modified Wednesday, October Deleted Observations 0
10, 2007 07:41:04
Protection Compressed NO
Data Set Type Sorted NO
Label
Data Representation WINDOWS_32
Encoding wlatin1 Western (Windows)
Engine/Host Dependent Information
Data Set Page Size 4096
Number of Data Set Pages 1
First Data Page 1
Max Obs per Page 101
Obs in First Data Page 1
Number of Data Set Repairs 0
File Name C:\TEMP\SAS Temporary Files\_TD246\oranges.sas7bdat
Release Created 9.0201B0
Host Created XP_PRO
Alphabetic List of Variables and Attributes
# Variable Type Len
2 flavor Num 8
4 looks Num 8
3 texture Num 8
5 total Num 8
1 variety Char 8
The size of the resulting
data set depends on the data set page size and the number of observations.
The following formula can be used to estimate the data set size:

number of data pages = 1 + (floor(number
of obs / Max Obs per Page
))

size = 1024 + (Data
Set Page Size
* number of data pages)
(floor represents a function that rounds the value down to the nearest
integer.)

number of data pages = 1 + (floor(1/101))

size = 1024 + (4096 * 1) = 5120
Thus, the example data
set uses 5,120 bytes of storage space.