BookmarkSubscribeRSS Feed
cluelesssas
Fluorite | Level 6

I'm on SAS Studio, SAS on Demand in web browser. If I do

data mydat;
	j=1;
run;
proc contents data=mydat;
run;

it will say the File Size is ~256KB, even though the table is just 1 row, 1 column, storing the number 1.

That's also the file size if I try to download mydat as a .sas7bdat file.

I tried googling about minimum file sizes for .sas7bdat files but couldn't find anything useful. While 256KB isn't 'big' these days, it's still concerning to me that it takes even that much to store something so simple.

5 REPLIES 5
Tom
Super User Tom
Super User

Since SAS7BAT files are BINARY files that are written in blocks the minimum size depends on the blocksize being used.  I am not sure exactly how SAS decides what blocksize to use but I suspect is is heavily influenced by the blocksized used by the device that you are writing the SAS file to. Check the settings of the device that you wrote the file on.

ChrisHemedinger
Community Manager

SAS data set files (sas7bdat) are structured with a header (fast to read, contains metadata like variable attributes, modified/created datetimes, etc) and then the data records, which are structured in "pages". The size of a page depends on the operating system and BUFSIZE option. These predictable page sizes allow for optimized reading and writing in the SAS I/O routines. This also means that your data set file size will be a multiple of the page size value.

 

By default BUFSIZE is set to 0, which lets SAS decide the best value based on the operating system and its I/O nuances.

Become an Explorer! Join SAS Analytics Explorers to learn and complete challenges that earn rewards!
SASKiwi
PROC Star

Dataset file size is governed by the number of data pages and their size like so:

SASKiwi_0-1769464363374.png

In the above there is one data set page and one data page for a total of two, hence the file size of 128K. Please post the same from your PROC CONTENTS.

cluelesssas
Fluorite | Level 6

Hi SASKiwi,

here it is

sas_filesize.png

Tom
Super User Tom
Super User

Try telling SAS what BUFSIZE to use instead of accepting the default.

data _null_;
  call execute('data b000 ');
  do k=1,2,4,8,16,32,64,128,256,512;
    call execute(cats('b',put(k,z3.),'(bufsize=',k,'k)')||' ');
  end;
  call execute(';x=1;run;');
run;

proc contents data=work._all_ out=contents memtype=data; 
run;
 NOTE: CALL EXECUTE generated line.
 1         + data b000
 2         + b001(bufsize=1k)
 3         + b002(bufsize=2k)
 4         + b004(bufsize=4k)
 5         + b008(bufsize=8k)
 6         + b016(bufsize=16k)
 7         + b032(bufsize=32k)
 8         + b064(bufsize=64k)
 9         + b128(bufsize=128k)
 10        + b256(bufsize=256k)
 11        + b512(bufsize=512k)
 12        + ;x=1;run;
 
 NOTE: The data set WORK.B000 has 1 observations and 1 variables.
 NOTE: The data set WORK.B001 has 1 observations and 1 variables.
 NOTE: The data set WORK.B002 has 1 observations and 1 variables.
 NOTE: The data set WORK.B004 has 1 observations and 1 variables.
 NOTE: The data set WORK.B008 has 1 observations and 1 variables.
 NOTE: The data set WORK.B016 has 1 observations and 1 variables.
 NOTE: The data set WORK.B032 has 1 observations and 1 variables.
 NOTE: The data set WORK.B064 has 1 observations and 1 variables.
 NOTE: The data set WORK.B128 has 1 observations and 1 variables.
 NOTE: The data set WORK.B256 has 1 observations and 1 variables.
 NOTE: The data set WORK.B512 has 1 observations and 1 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.01 seconds
       cpu time            0.00 seconds

Screenshot 2026-01-26 at 5.09.39 PM.png

 

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 798 views
  • 8 likes
  • 4 in conversation