<?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 Re: Length statement Increasing Data Size in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604255#M175160</link>
    <description>If you know that the maximum length is 600, consider changing the length to 600 instead of 2000. It should reduce space as well. SAS has to allocate that much space regardless of it being used or not so that's what takes up the space.</description>
    <pubDate>Thu, 14 Nov 2019 19:41:38 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-11-14T19:41:38Z</dc:date>
    <item>
      <title>Length statement Increasing Data Size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604244#M175150</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a data set that I needed to concatenate the rows for each ID. I had to use LENGTH statement to allocate enough bytes for the new variables created. Allocated 2000 bytes. However many of the text length doesn't even exceed 500-600 bytes. Because I allocated 2K bytes and even though I used a strip and trim functions later to get rid of the embedded blank spaces; to size of the&amp;nbsp;dataset increased by 7 times the original dataset.&amp;nbsp;from 12 GB (CUST_REMARK_TB_SAS) &amp;nbsp;to 70GB (CUST_REMARK_CAT)&lt;/P&gt;&lt;P&gt;can anyone tell me &amp;nbsp;why &amp;nbsp;this is happening. Please help me fix this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bnknts.CUST_REMARK_CAT;
	length CAT_REMK_TEXT $2000.;/*allocate 2K bytes for concatanation operation*/

	do until (last.remk_placed_date);
		set bnknts.CUST_REMARK_TB_SAS;
		by cust_id remk_placed_date;
		CAT_REMK_TEXT=catx(' ',CAT_REMK_TEXT,remark_text);
	end;

	cust_remk_text=lowcase(strip(trim(CAT_REMK_TEXT)));
	LEN=length(cust_remk_text);
	drop remark_text CAT_REMK_TEXT remk_occ_nbr;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Nov 2019 18:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604244#M175150</guid>
      <dc:creator>eserates</dc:creator>
      <dc:date>2019-11-14T18:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Length statement Increasing Data Size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604247#M175153</link>
      <description>&lt;P&gt;By default, SAS increases the dataset size by the size of your&amp;nbsp;CAT_REMK_TEXT variable including blank space. To remove the blank space from your dataset use the COMPRESS = YES option:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bnknts.CUST_REMARK_CAT (compress = yes);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Nov 2019 18:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604247#M175153</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-14T18:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Length statement Increasing Data Size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604248#M175154</link>
      <description>&lt;P&gt;SAS stores character variables as fixed length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to save disk space make sure to use the COMPRESS= dataset option. Otherwise compression is used when writing the data to disk and every observation will require 2000 bytes for just that variable.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=ledsoptsref&amp;amp;docsetTarget=n014hy7167t2asn1j7qo99qv16wa.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=ledsoptsref&amp;amp;docsetTarget=n014hy7167t2asn1j7qo99qv16wa.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 18:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604248#M175154</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-14T18:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Length statement Increasing Data Size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604249#M175155</link>
      <description>&lt;P&gt;then what is the remedy to make the size smaller. As you can see in my code I am using&amp;nbsp;cust_remk_text&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;lowcase&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;strip&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;trim&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;CAT_REMK_TEXT&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; to eliminate it but not working. \thanks&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 18:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604249#M175155</guid>
      <dc:creator>eserates</dc:creator>
      <dc:date>2019-11-14T18:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Length statement Increasing Data Size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604251#M175157</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/298715"&gt;@eserates&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;then what is the remedy to make the size smaller. As you can see in my code I am using&amp;nbsp;cust_remk_text&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;lowcase&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;strip&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;trim&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;CAT_REMK_TEXT&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; to eliminate it but not working. \thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;How would that make the value stored any smaller? All you did was take of the trailing spaces, then remove the leading spaces (and the now already gone trailing spaces) and then stick it back into the same 2,000 byte variable where the spaces will be appended again.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 19:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604251#M175157</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-14T19:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Length statement Increasing Data Size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604253#M175159</link>
      <description>&lt;P&gt;thanks for your responses. I will try COMPRESS option.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 19:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604253#M175159</guid>
      <dc:creator>eserates</dc:creator>
      <dc:date>2019-11-14T19:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Length statement Increasing Data Size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604255#M175160</link>
      <description>If you know that the maximum length is 600, consider changing the length to 600 instead of 2000. It should reduce space as well. SAS has to allocate that much space regardless of it being used or not so that's what takes up the space.</description>
      <pubDate>Thu, 14 Nov 2019 19:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-statement-Increasing-Data-Size/m-p/604255#M175160</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-14T19:41:38Z</dc:date>
    </item>
  </channel>
</rss>

