<?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: Proc sql column lenght always in 4000 bytes automatically .. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432681#M107185</link>
    <description>&lt;P&gt;I assume this is the length set at the database end?&amp;nbsp; You can use compress dataset options:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/rnd/base/datastep/compression.html" target="_blank"&gt;https://support.sas.com/rnd/base/datastep/compression.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This is the simplest and comrpess the dataset, so it does not matter how long the lengths are.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However if you want to get more complicated - i.e. more programming, harder to maintain, less robust, then you need to code it in your self.&amp;nbsp; First ascertain the max length of each variable, then use that information to reset the lengths, or generate the SQL code to set the lengths.&amp;nbsp; You don't really save anything doing it this way either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2018 11:44:11 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-01-31T11:44:11Z</dc:date>
    <item>
      <title>Proc sql column lenght always in 4000 bytes automatically ..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432674#M107183</link>
      <description>&lt;P&gt;I Have few Test Cases all of them run using Proc sql and one key thing i have noticed that the variable / column value always set to &amp;nbsp;4000 bytes automatically but is there a way to dymically assign based on the values ? for each dataset .&lt;/P&gt;&lt;P&gt;Because &amp;nbsp;dataset1 &amp;nbsp;value might enough with &amp;nbsp;30 bytes but datset2 value&amp;nbsp;&lt;SPAN&gt;might not be enough with &amp;nbsp;30 bytes .. so i need to tell the sas to allocate the memory (lenght ) based the data it process !&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there anyway i can do it ? experts pls help me out&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18228i7848121F93C913CE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 11:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432674#M107183</guid>
      <dc:creator>srinidelite</dc:creator>
      <dc:date>2018-01-31T11:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql column lenght always in 4000 bytes automatically ..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432677#M107184</link>
      <description>&lt;P&gt;You can use a Macro to pass the lengths to the columns during table creation&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro creation(var1=, var2=);

proc sql;

create table testcase (

var1 char(&amp;amp;var1.),

var2 char(&amp;amp;var2.)

);

quit;

%mend;

%creation(var1=12, var2=8);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 11:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432677#M107184</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-01-31T11:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql column lenght always in 4000 bytes automatically ..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432681#M107185</link>
      <description>&lt;P&gt;I assume this is the length set at the database end?&amp;nbsp; You can use compress dataset options:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/rnd/base/datastep/compression.html" target="_blank"&gt;https://support.sas.com/rnd/base/datastep/compression.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This is the simplest and comrpess the dataset, so it does not matter how long the lengths are.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However if you want to get more complicated - i.e. more programming, harder to maintain, less robust, then you need to code it in your self.&amp;nbsp; First ascertain the max length of each variable, then use that information to reset the lengths, or generate the SQL code to set the lengths.&amp;nbsp; You don't really save anything doing it this way either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 11:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432681#M107185</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-31T11:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql column lenght always in 4000 bytes automatically ..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432682#M107186</link>
      <description>&lt;P&gt;It doesn't work for me&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 11:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432682#M107186</guid>
      <dc:creator>srinidelite</dc:creator>
      <dc:date>2018-01-31T11:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql column lenght always in 4000 bytes automatically ..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432689#M107187</link>
      <description>&lt;P&gt;deleted&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jun 2018 05:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432689#M107187</guid>
      <dc:creator>srinidelite</dc:creator>
      <dc:date>2018-06-18T05:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql column lenght always in 4000 bytes automatically ..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432767#M107221</link>
      <description>&lt;P&gt;I have made a small change, if you see any error, please post the log&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro creation(Value);

     Proc Sql;
        Create table Target as 
            select 
                t2.NUM,
                t2.ID,
                t2.NCEID,
                t4.POLOBJECTID,
                t3.PRODUCTVERSIONOBJECTID,
                t4.EXTERNALIDENTIFIER as ExternalID,
                t4.Value as Value  length = &amp;amp;Value.                     *Change;
            from  &amp;amp;wrkschema.. lkp_policyinstance t2
                inner join &amp;amp;tgtschema.. INS t3
                    on t2.rpinstid  = t3.POLICYINSTANCEID     and t2.cdnumpol  =  '002011216756'
                inner join &amp;amp;tgtschema.. POLOBJt4
                    on t3.identifier = t4.POLINOBJ
                Where t4.externalidentifier =  &amp;amp;extrniden. and t3.CHECK= &amp;amp;objMotorbike.
        ;
    quit;

%mend;

%creation(Value=40);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jan 2018 14:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-column-lenght-always-in-4000-bytes-automatically/m-p/432767#M107221</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-01-31T14:51:19Z</dc:date>
    </item>
  </channel>
</rss>

