Hi,
We have been using the macro %Squeeze for years. you can find it in the SAS Notes here:
http://support.sas.com/kb/24/804.html
Attached is an update to this macro, where I have expanded it's scope to include Libnames defined on Databases, ODBC for MS SQL Server, or maybe others. It depends on the implicit pass through abilities of that SAS-Database Relationship for it to work well. That is, the SQL used to get the sizes of the columns needed to reduce the overall size of the table needs to be performed on the database server side. It works for us using ODBS to a MS SQL Server database. I have no access to other databases, so there has been no testing for these.
We are using it to insure the size of the data coming from these places are reasonable, and maybe to speed up the writing of this data.
I give it here, without support, for others to enjoy or curse at .
Mike
@mwhitaker - Thanks for posting. I fully understand why you have enhanced %SQUEEZE for MS SQL Server ODBC tables. The default sizes of character variables in SAS tables created from SQL Server are usually far too big and result in large disk file sizes.
An alternative approach for dealing with data coming in from external databases is to use the SAS option COMPRESS - BINARY is my preferred method. While it isn't as tidy as %SQUEEZE, it deals with the file size issue very effectively with little impact on CPU.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.