BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
caveman529
Calcite | Level 5

Ladies and Gentlemen:

I forgot to put the option (compress=yes) in my original code when creating dataset.  Is there a way to compress those SAS datasets in a batch mode?  There are too many of them to do it manually? 

I found this:

*----------------------------------------------------------------------;

* Copying datasets adding compression ;

*----------------------------------------------------------------------;

%let path=.;

options compress=yes ;

libname in "&path";

libname out "&path";

proc copy inlib=in outlib=out noclone datecopy memtype=data ;

run;

But I'm not sure this works or not, or it is the correct way for doing so.  Thanks -

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

Some code like below should do the job:

options compress=yes;

libname temp "c:\tests";
libname source (work);

proc datasets lib=temp kill nowarn nolist;
    copy inlib=work outlib=temp noclone datecopy memtype=data index=yes constraint=yes;
  run;
    copy inlib=temp outlib=work noclone datecopy memtype=data index=yes constraint=yes move;
  run;
quit;

libname temp clear;

View solution in original post

3 REPLIES 3
LinusH
Tourmaline | Level 20

In 9.4 at least, SAS will stop you from doing that - you haven't tested yourself?

The simplest seems to have the tables compressed in alternate location.

Data never sleeps
caveman529
Calcite | Level 5

Many thanks for your help.  I found compress data reduce I/O quite a bit...

Patrick
Opal | Level 21

Some code like below should do the job:

options compress=yes;

libname temp "c:\tests";
libname source (work);

proc datasets lib=temp kill nowarn nolist;
    copy inlib=work outlib=temp noclone datecopy memtype=data index=yes constraint=yes;
  run;
    copy inlib=temp outlib=work noclone datecopy memtype=data index=yes constraint=yes move;
  run;
quit;

libname temp clear;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 9874 views
  • 0 likes
  • 3 in conversation