|
|
||||||
MINIME: Reset variable lengths to minimize the size of a SAS datasetDownload minime.sas If you are not prompted to "Save To Disk", then right-click the link and choose "Save Link Target As..." Otherwise, you will need to save the web page to your computer. Make sure you save the minime.sas file as a plain
text file not an htm/html file.
Disclaimer: There is no warranty on this software either expressed or implied. This program is released under the terms and conditions of GNU General Public License. About MINIME
Programmer: Dan Blanchette ()
Center for Entrepreneurship and Innovation Duke University's Fuqua School of Business Durham, NC USA Date: 22May2003 Last updated: 09Mar2009 Reset the variable lengths to minimize the size of a SAS dataset
%minime( variables not to minimize , variables to minimize );
Description
The MINIME SAS macro resets variable lengths of the dataset most recently created in the WORK library
to the safest minimum for all operating systems. This should reduce the size of the SAS datafile, but it could
increase it, perhaps appropriately so. This is like the Stata command
compress.
Options
NOTE: The parameters have to be specified in the order of this list.
How to use the MINIME macro:
Using the MINIME SAS macro requires that you understand how to use the %include
statement and that you know how to call a SAS macro.
%include "LOCATION AND NAME OF A FILE THAT CONTAINS SAS CODE"; For example, if you have copied this file to " C:\SASmacros", then you
tell SAS about this macro by adding the following line to your SAS program:
%include "C:\SASmacros\minime.sas"; The include statement makes SAS aware of the MINIME SAS macro which is in the file minime.sas.
You call the macro by adding this to your code:
%minime; Examples
%include "C:\SASmacros\minime.sas"; ** Make SAS aware of the MINIME macro.**;
data work.new;
set work.old;
run;
** now call the MINIME SAS macro to minimize all the variables in the dataset **;
%minime;
******************************************************************
-- To see the attrib statement MINIME used to reset the variable
lengths, use the PRINTME SAS macro after MINIME has run:
******************************************************************;
%printme;
proc contents data= work.new;
run;
** or all character variables **;
data work.new;
set work.old;
run;
%minime( , _character_ ); ** notice that the first field is empty and
* that a comma separates the two fields **;
proc contents data= work.new;
run;
** or only the numeric variables except for you ID variable: **;
data work.new;
set work.old;
run;
%minime( companyid , _numeric_ );
proc contents data= work.new;
run;
** or all variables except for you ID variable: **;
data work.new;
set work.old;
run;
%minime( companyid );
proc contents data= work.new;
run;
Back to Main Page Questions or comments? Send them to Dan Blanchette () |