<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252450#M47912</link>
    <description>&lt;P&gt;Because the variable length is already defined by the set statment as in the original data set.&lt;/P&gt;
&lt;P&gt;When it will be 12? if the length statment come before the set statament. So order is very important here.&lt;/P&gt;
&lt;P&gt;And if you have practicing SAS programming &amp;nbsp;you will know that if you run this programe you will get a warning.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; WARNING: Length of character variable &lt;SPAN&gt;jobcode&lt;/SPAN&gt; has already been set. 
          Use the LENGTH statement as the very first statement in the DATA STEP to declare the length of a character variable.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And not 8 for two reasons the one mentioned above plus this length is not defined any where in the data step or the original data and it is char not number.&amp;nbsp;where if it is number&amp;nbsp;the max length is 8.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2016 17:57:45 GMT</pubDate>
    <dc:creator>mohamed_zaki</dc:creator>
    <dc:date>2016-02-25T17:57:45Z</dc:date>
    <item>
      <title>Length Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252441#M47905</link>
      <description>&lt;P&gt;QUESTION 64&lt;BR /&gt;The following SAS DATA step is submitted:&lt;BR /&gt;data work.accountting;&lt;BR /&gt;set work.department;&lt;BR /&gt;length jobcode$ 12;&lt;BR /&gt;run;&lt;BR /&gt;The WORK.DEPARTMENT SAS data set contains a character variable named&lt;BR /&gt;JOBCODE with a length of 5.&lt;BR /&gt;Which one of the following is the length of the variable JOBCODE in the output&lt;BR /&gt;data set?&lt;BR /&gt;&lt;BR /&gt;A. 5&lt;BR /&gt;B. 8&lt;BR /&gt;C. 12&lt;BR /&gt;D. The length can not be determined as the program fails to execute due to errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ans –A &amp;nbsp;(&lt;STRONG&gt;WHY? Why not 12?&lt;/STRONG&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 17:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252441#M47905</guid>
      <dc:creator>Bulleride</dc:creator>
      <dc:date>2016-02-25T17:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Length Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252450#M47912</link>
      <description>&lt;P&gt;Because the variable length is already defined by the set statment as in the original data set.&lt;/P&gt;
&lt;P&gt;When it will be 12? if the length statment come before the set statament. So order is very important here.&lt;/P&gt;
&lt;P&gt;And if you have practicing SAS programming &amp;nbsp;you will know that if you run this programe you will get a warning.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; WARNING: Length of character variable &lt;SPAN&gt;jobcode&lt;/SPAN&gt; has already been set. 
          Use the LENGTH statement as the very first statement in the DATA STEP to declare the length of a character variable.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And not 8 for two reasons the one mentioned above plus this length is not defined any where in the data step or the original data and it is char not number.&amp;nbsp;where if it is number&amp;nbsp;the max length is 8.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 17:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252450#M47912</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-02-25T17:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Length Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252456#M47916</link>
      <description>But won't this length statement overwrite the length that the original data set contained and make it 12?</description>
      <pubDate>Thu, 25 Feb 2016 18:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252456#M47916</guid>
      <dc:creator>Bulleride</dc:creator>
      <dc:date>2016-02-25T18:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Length Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252459#M47919</link>
      <description>&lt;P&gt;No, not in SAS.&amp;nbsp;Only if it come before the set statment in the order in your data step.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 18:13:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-Statement/m-p/252459#M47919</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-02-25T18:13:46Z</dc:date>
    </item>
  </channel>
</rss>

