BookmarkSubscribeRSS Feed
jerry898969
Pyrite | Level 9
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
5 REPLIES 5
Doc_Duke
Rhodochrosite | Level 12
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.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Also, the CONTENTS listing will tell you if either file is using the SAS COMPRESS option.

Scott Barry
SBBWorks, Inc.
DanielSantos
Barite | Level 11
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
jerry898969
Pyrite | Level 9
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
DanielSantos
Barite | Level 11
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register 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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 716 views
  • 0 likes
  • 4 in conversation