<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Compression Says NO in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786398#M251080</link>
    <description>&lt;P&gt;In a default SAS environment, COMPRESS=NO.&amp;nbsp; You can set COMPRESS=YES|CHAR|ON (or BINARY) at the level of system option, library and dataset.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I have a table that's going to grow.&amp;nbsp; Here is what I tried:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options compress=char;
libname sascom (work) compress=char;
proc sql;
create table sascom.amgonnagrow(compress=char)(my num, your char);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here's what happened:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV id="sasLogNote2_1639694186078" class="sasNote"&gt;NOTE: Compression was disabled for data set SASCOM.AMGONNAGROW because compression overhead would increase the size of the data set.&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Compression was not applied!!&lt;BR /&gt;&lt;BR /&gt;I tried the same thing with a data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sascom.amgonnagrow(compress=char);
  length my 8 your $200;
  call missing(of _all_);
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to force an existing, empty table to have the compress applied?&amp;nbsp; Or some trick in SQL to apply the compress on initialisation?&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Dec 2021 22:46:39 GMT</pubDate>
    <dc:creator>AllanBowe</dc:creator>
    <dc:date>2021-12-16T22:46:39Z</dc:date>
    <item>
      <title>Compression Says NO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786398#M251080</link>
      <description>&lt;P&gt;In a default SAS environment, COMPRESS=NO.&amp;nbsp; You can set COMPRESS=YES|CHAR|ON (or BINARY) at the level of system option, library and dataset.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I have a table that's going to grow.&amp;nbsp; Here is what I tried:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options compress=char;
libname sascom (work) compress=char;
proc sql;
create table sascom.amgonnagrow(compress=char)(my num, your char);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here's what happened:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV id="sasLogNote2_1639694186078" class="sasNote"&gt;NOTE: Compression was disabled for data set SASCOM.AMGONNAGROW because compression overhead would increase the size of the data set.&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Compression was not applied!!&lt;BR /&gt;&lt;BR /&gt;I tried the same thing with a data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sascom.amgonnagrow(compress=char);
  length my 8 your $200;
  call missing(of _all_);
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to force an existing, empty table to have the compress applied?&amp;nbsp; Or some trick in SQL to apply the compress on initialisation?&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 22:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786398#M251080</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-12-16T22:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Compression Says NO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786401#M251082</link>
      <description>&lt;P&gt;The issue with my example was, in fact, the short length of the observation.&amp;nbsp; As per the &lt;A href="http://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrcon/p0y0x1j67vtqhnn1on1cs7trim16.htm" target="_self"&gt;docs&lt;/A&gt;:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The V9&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN aria-live="polite"&gt;&lt;BUTTON class="Glossary_term__1sogC LinkButton_button__17uC9" aria-label="engine"&gt;&lt;SPAN class="xisDoc-glossTerm" data-gloss-term="1"&gt;engine&lt;/SPAN&gt;&lt;/BUTTON&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;compresses one observation at a time, and adds a fixed-length&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN aria-live="polite"&gt;&lt;BUTTON class="Glossary_term__1sogC LinkButton_button__17uC9" aria-label="block"&gt;&lt;SPAN class="xisDoc-glossTerm" data-gloss-term="1"&gt;block&lt;/SPAN&gt;&lt;/BUTTON&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;of data to each observation. Because of the additional block of data, some&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN aria-live="polite"&gt;&lt;BUTTON class="Glossary_term__1sogC LinkButton_button__17uC9" aria-label="data sets"&gt;&lt;SPAN class="xisDoc-glossTerm" data-gloss-term="1"&gt;data sets&lt;/SPAN&gt;&lt;/BUTTON&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;would result in a larger file size if compressed. For example, a data set with an extremely short observation length would not benefit from compression.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Indeed, increasing the length of the char var in SQL enables the compression:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="sasSource"&gt;73 proc sql;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;74 create table demo16(compress=char)(my num, your char length=16);&lt;/DIV&gt;
&lt;DIV id="sasLogNote1_1639697501228" class="sasNote"&gt;NOTE: Compression was disabled for data set WORK.DEMO16 because compression overhead would increase the size of the data set.&lt;/DIV&gt;
&lt;DIV id="sasLogNote2_1639697501228" class="sasNote"&gt;NOTE: Table WORK.DEMO16 created, with 0 rows and 2 columns.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;75 create table demo17(compress=char)(my num, your char length=17);&lt;/DIV&gt;
&lt;DIV id="sasLogNote3_1639697501228" class="sasNote"&gt;NOTE: Table WORK.DEMO17 created, with 0 rows and 2 columns.&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There must be some other reason why my tables aren't compressed - am off now, to find it!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 23:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786401#M251082</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-12-16T23:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compression Says NO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786402#M251083</link>
      <description>&lt;P&gt;Why would a dataset "grow"?&lt;/P&gt;
&lt;P&gt;Are you trying to use SAS as a transactional database system?&lt;/P&gt;
&lt;P&gt;Just make a new dataset when it gets bigger.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 23:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786402#M251083</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-16T23:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Compression Says NO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786405#M251085</link>
      <description>Hi Tom - we build HTML interfaces using SAS as a backend. Whilst we always recommend a database for transactional processing, in reality - as I'm sure you appreciate - it's not always possible.  For sure we could ask the client to implement some batch job to rebuild the table on a regular basis, but that would be a last resort.&lt;BR /&gt;&lt;BR /&gt;I actually found a way to apply the COMPRESS attribute to an empty table, and will share here once published!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Dec 2021 23:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786405#M251085</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-12-16T23:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Compression Says NO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786411#M251089</link>
      <description>&lt;P&gt;You mean like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test(compress=yes reuse=yes);
  length x1-x2 8;
run;
proc sql;
  delete * from test;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Dec 2021 01:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786411#M251089</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-17T01:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compression Says NO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786422#M251093</link>
      <description>&lt;P&gt;Does it have to be SQL? A data step and proc append(replacing "insert") seems to be doing ok:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A(compress=yes reuse=yes);
  stop;
  length i 8 x1 - x10 $ 2;
run;

proc contents data = A;
run;

data B;
  do i = 1 to 100;
    array x[10] $ 2 (10*"A");
    output;
  end;
run;

proc append base = A data = B;
run;

proc contents data = A;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 08:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786422#M251093</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-12-17T08:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Compression Says NO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786602#M251181</link>
      <description>actually the approach was to simply APPEND where the base table did not previously exist.  This applied the compression, and also copies all of the constraints etc.&lt;BR /&gt;This macro serves:  &lt;A href="https://core.sasjs.io/mp__sortinplace_8sas.html" target="_blank"&gt;https://core.sasjs.io/mp__sortinplace_8sas.html&lt;/A&gt;</description>
      <pubDate>Sat, 18 Dec 2021 14:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compression-Says-NO/m-p/786602#M251181</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-12-18T14:39:42Z</dc:date>
    </item>
  </channel>
</rss>

