Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_ds2squeeze.sas File Reference

Create a smaller version of a dataset, without data loss. More...

Go to the source code of this file.

Detailed Description

This macro will scan the input dataset and create a new one, that has the minimum variable lengths needed to store the data without data loss.

Inspiration was taken from How to Reduce the Disk Space Required by a SASĀ® Data Set by Selvaratnam Sridharma. The end of the referenced paper presents a macro named "squeeze", hence the nomenclature.

Usage:

data big;
  length my big $32000;
  do i=1 to 1e4;
    my=repeat('oh my',100);
    big='dawg';
    special=._;
    output;
  end;
run;

%mp_ds2squeeze(work.big,outds=work.smaller)

The following will also be printed to the log (exact values may differ depending on your OS and COMPRESS settings):

‍MP_DS2SQUEEZE: work.big was 625MB

‍MP_DS2SQUEEZE: work.smaller is 5MB

Parameters
[in]libdsThe library.dataset to be squeezed
[out]outds=(work.mp_ds2squeeze) The squeezed dataset to create
[in]mdebug=(0) Set to 1 to enable DEBUG messages

SAS Macros

Related Programs

Version
9.3
Author
Allan Bowe

Definition in file mp_ds2squeeze.sas.