<?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: Maximum lenght of variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873753#M345218</link>
    <description>&lt;P&gt;Yes- that worked. After compressing the size is smaller than the original dataset. Is there any way to include the compress option in the macro so that it doesn't require an additional data step?&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2023 23:44:28 GMT</pubDate>
    <dc:creator>bayzid</dc:creator>
    <dc:date>2023-05-03T23:44:28Z</dc:date>
    <item>
      <title>Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873734#M345209</link>
      <description>&lt;P&gt;How can i find out maximum length of all the variables in a SAS dataset and then use those lengths to create a new dataset?&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 20:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873734#M345209</guid>
      <dc:creator>bayzid</dc:creator>
      <dc:date>2023-05-03T20:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873735#M345210</link>
      <description>&lt;P&gt;You don't need to.&amp;nbsp; This program will create a new data set with zero observations, but using all variable definitions from the old data set (including lengths):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new_dataset;
   stop;
   set old_dataset;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you need a printed version of the data set structure, use PROC CONTENTS.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 20:57:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873735#M345210</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-05-03T20:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873736#M345211</link>
      <description>Do you mean you want to resize the character variables to the length of the longest value?</description>
      <pubDate>Wed, 03 May 2023 21:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873736#M345211</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2023-05-03T21:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873749#M345214</link>
      <description>&lt;P&gt;Yes- I want to do that for both numeric and character variables. Some of the variables have greater length than maximum length. Using COMPRESS option in the dataset can reduce the size but do not change the variable length which creates an inflated dataset when transformed to other formats.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 23:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873749#M345214</guid>
      <dc:creator>bayzid</dc:creator>
      <dc:date>2023-05-03T23:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873750#M345215</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/108705"&gt;@bayzid&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use my attached macro (etl_shrinkMyData.sas) It does exactly what you are looking for.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include "etl_shrinkmydata.sas"; 
%etl_shrinkMyData(p_inDsName=SASHELP.PRDSALE
, p_outDsName=WORK.shrunk, p_noCompress=);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 23:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873750#M345215</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2023-05-03T23:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873751#M345216</link>
      <description>&lt;P&gt;Hi Ahmed,&lt;BR /&gt;Thanks for the macro. It worked to reduce the variable length but the size of the dataset has been inflated &amp;gt;4 times.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 23:36:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873751#M345216</guid>
      <dc:creator>bayzid</dc:creator>
      <dc:date>2023-05-03T23:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873752#M345217</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/108705"&gt;@bayzid&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's most likely because your original data set was compressed while the newly shrunk data set has shorter record length.&lt;/P&gt;
&lt;P&gt;You can run Proc Content against both data sets and compare the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you compressed the shrunk data set, it will probably end up same size as the original if not smaller&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 23:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873752#M345217</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2023-05-03T23:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873753#M345218</link>
      <description>&lt;P&gt;Yes- that worked. After compressing the size is smaller than the original dataset. Is there any way to include the compress option in the macro so that it doesn't require an additional data step?&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 23:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873753#M345218</guid>
      <dc:creator>bayzid</dc:creator>
      <dc:date>2023-05-03T23:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873760#M345220</link>
      <description>Use &lt;BR /&gt;Options compress=yes;&lt;BR /&gt;before calling the macro</description>
      <pubDate>Thu, 04 May 2023 00:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873760#M345220</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2023-05-04T00:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873767#M345222</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/108705"&gt;@bayzid&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes- that worked. After compressing the size is smaller than the original dataset. Is there any way to include the compress option in the macro so that it doesn't require an additional data step?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I didn't look at the source code of the macro, since it was shared as an attached instead of in the body of the message, but from the sample call you should be able to just add the COMPRESS= option to the output dataset name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%etl_shrinkMyData
(p_inDsName=SASHELP.PRDSALE
,p_outDsName=WORK.shrunk(compress=yes)
,p_noCompress=
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or set the system option COMPRESS before calling the macro.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 02:42:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873767#M345222</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-04T02:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lenght of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873768#M345223</link>
      <description>&lt;P&gt;Yes- that worked.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 02:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lenght-of-variables/m-p/873768#M345223</guid>
      <dc:creator>bayzid</dc:creator>
      <dc:date>2023-05-04T02:44:55Z</dc:date>
    </item>
  </channel>
</rss>

