DATA Step, Macro, Functions and more

Table size issue

Reply
Super Contributor
Posts: 400

Table size issue

Hello,
I have an issue with making a copy of a table. I pull in a table from one of my libraries. That table is 1600K in windows. I then do this data step


libname from "c:\temp\from" ;
libname to "c:\temp\to" ;

data temp1 ;
set from.temp1 ;
run ;

data to.temp1 ;
set temp1 ;
run ;

from.temp has a size of 1,681K within windows
After I run the two data steps and go to "c:\temp\to" temp1 is over 200K.
I can't figure out what I'm missing any help would be greatly appreciated.

Thank You
Trusted Advisor
Posts: 2,115

Re: Table size issue

Posted in reply to jerry898969
Do a PROC CONTENTS on each of the datasets and see what is different.

SAS datasets are direct access files when stored. The from. dataset may have had a number of records deleted in place. When you go from from.temp1 to to.temp1 libraries, the copy is sequential and any "extra" space is given back to the OS.

Another possibility is that there are indices on from.temp1 and not on to.temp1.
Super Contributor
Super Contributor
Posts: 3,174

Re: Table size issue

Also, the CONTENTS listing will tell you if either file is using the SAS COMPRESS option.

Scott Barry
SBBWorks, Inc.
Super Contributor
Posts: 474

Re: Table size issue

Hello.

Being both libnames on the same physical storage, and as already stated, this is probably the physical elimination of deleted rows.
Copying a table through a DATA/SET statement is rather a row by row copy procedure than an actually copying the file. The destination tables gets reorganized and so, previously deleted row are skipped in the copy procedure.

Just do the same with the original table, over itself (DATA ORIGINAL; SET ORIGINAL; RUN; /* make sure backup the table first */), you should get the 200K size also.

Since you are not explicitly using the COMPRESS option, and unless its default value was set to YES AFTER the original dataset was created, the copied dataset maybe compressed. Just issue the following to see the current value of the COMPRESS option (default is NO):

PROC OPTIONS; RUN;

Cheers from Portugal.

Daniel Santos @ www.cgd.pt
Super Contributor
Posts: 400

Re: Table size issue

Posted in reply to DanielSantos
Daniel and Scott,
Thank you both for your replies.
I was pulled away from this issue till tomorrow so I didn't mean any disrespect by not replying right away.

I stated the size incorrectly. My original table is about 16mb(1,600K) when I do the data step that table becomes 220mb(220,000K). So i'm going from a small table to a really big table.

I will definitely do all your suggestions ASAP

Thank You
Super Contributor
Posts: 474

Re: Table size issue

Posted in reply to jerry898969
Oh. OK.

Than follow Scott's suggestion and see if the original table is compress through the PROC CONTENTS procedure.

Cheers from Portugal.

Daniel Santos @ www.cgd.pt
Ask a Question
Discussion stats
  • 5 replies
  • 153 views
  • 0 likes
  • 4 in conversation