<?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: Confused on the length of this variable, thx in advance in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212446#M52468</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everybody, I understand now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 May 2015 13:59:58 GMT</pubDate>
    <dc:creator>cj9000</dc:creator>
    <dc:date>2015-05-11T13:59:58Z</dc:date>
    <item>
      <title>Confused on the length of this variable, thx in advance</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212442#M52464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 12pt 0; background-position: initial;"&gt;&lt;STRONG style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;Question:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; background-position: initial;"&gt;&lt;STRONG style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;The following SAS program is submitted:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; background-position: initial;"&gt;&lt;EM style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;data work.test;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; background-position: initial;"&gt;&lt;EM style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;First = 'Ipswich, England';&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; background-position: initial;"&gt;&lt;EM style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;City_Country = substr(First,1,7)!!', '!!'England';&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; background-position: initial;"&gt;&lt;EM style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;run;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; background-position: initial;"&gt;&lt;STRONG style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;Which one of the following is the length of the variable CITY_COUNTRY in the output data set? &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; background-position: initial;"&gt;&lt;STRONG style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;How is this variable length 25; I counted 17 and the length= statement gave 16 which i understand but not the 25.&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; background-position: initial;"&gt;&lt;STRONG style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;Thanks&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 12.0pt; margin-bottom: 10.0pt; margin-left: 43.5pt; background: white;"&gt;&lt;STRONG style="color: #464646; font-size: 10.0pt; font-family: 'Verdana','sans-serif';"&gt;Response:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" style="margin-left: .5in;" width="700"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="border: none; border-bottom: solid #CCCCCC 1.0pt; background: #FDFFEF; padding: 2.25pt 2.25pt 2.25pt 2.25pt;"&gt;&lt;P style="margin-top: 12.0pt; margin-bottom: 12.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;25&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: none; border-bottom: solid #CCCCCC 1.0pt; background: #E3ECC0; padding: 2.25pt 2.25pt 2.25pt 2.25pt;"&gt;&lt;P style="margin-top: 12.0pt; margin-bottom: 12.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;7&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: none; border-bottom: solid #CCCCCC 1.0pt; background: #FDFFEF; padding: 2.25pt 2.25pt 2.25pt 2.25pt;"&gt;&lt;P style="margin-top: 12.0pt; margin-bottom: 12.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;6&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: none; border-bottom: solid #CCCCCC 1.0pt; background: #E3ECC0; padding: 2.25pt 2.25pt 2.25pt 2.25pt;"&gt;&lt;P style="margin-top: 12.0pt; margin-bottom: 12.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;17&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 May 2015 23:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212442#M52464</guid>
      <dc:creator>cj9000</dc:creator>
      <dc:date>2015-05-09T23:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Confused on the length of this variable, thx in advance</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212443#M52465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, you agree that First is 16 characters yes, so how many characters is ", England".&amp;nbsp; Add the two together and you get a maximum length which is then assigned to the new variable.&amp;nbsp; Because there is no length specified, SAS is cautious and applies maximum lengths needed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 09:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212443#M52465</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-11T09:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Confused on the length of this variable, thx in advance</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212444#M52466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very interesting question . It appeared that SAS take &lt;EM style="font-size: 10pt; font-family: Verdana, sans-serif; color: #464646; background-color: #ffffff;"&gt;substr(First,1,7) &lt;/EM&gt;has the same length as FIRST(16) , therefore you got 25 ,not 17 .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 12:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212444#M52466</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-11T12:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Confused on the length of this variable, thx in advance</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212445#M52467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To explain a bit more ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS has to decide on the lengths of variables before reading any data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When SAS sees the SUBSTR function, it does not examine the third parameter.&amp;nbsp; In fact, the third parameter (the number of characters to extract) might be an expression that changes from observation to observation.&amp;nbsp; So to be safe, SAS concludes that it might be taking ALL the characters from FIRST, and might need 16 characters to hold the output of SUBSTR.&lt;/P&gt;&lt;P&gt;So 16 for the output of SUBTR, plus 9 characters hard-coded after that = 25.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 12:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212445#M52467</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-05-11T12:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Confused on the length of this variable, thx in advance</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212446#M52468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everybody, I understand now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 13:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Confused-on-the-length-of-this-variable-thx-in-advance/m-p/212446#M52468</guid>
      <dc:creator>cj9000</dc:creator>
      <dc:date>2015-05-11T13:59:58Z</dc:date>
    </item>
  </channel>
</rss>

