<?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: scan function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/469316#M120027</link>
    <description>&lt;P&gt;Hi Sanyam,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From what I remember, if the destination variable does not have a specified length, SAS will set it to the length of the source.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Small test:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data toto;
  length a $200.;
  a = 'Hello World!';
  b = 'Hello World!';
  c = scan(a, 1, ' ');
  d = scan(b, 1, ' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c has length 200 and d has length 15.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I assume in the question the was something indicating the length of author.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 17:21:37 GMT</pubDate>
    <dc:creator>ybolduc</dc:creator>
    <dc:date>2018-06-11T17:21:37Z</dc:date>
    <item>
      <title>scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/469310#M120022</link>
      <description>&lt;P&gt;Data work;&lt;/P&gt;&lt;P&gt;author = 'agatha christie' ;&lt;/P&gt;&lt;P&gt;first = substr(scan(author,1, ' , ' ),1,1);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i find this question in a mock test,&amp;nbsp; question is what would be the length of the variable first in output data set&amp;nbsp; ,&amp;nbsp;Answer given in mock test for this is 200&amp;nbsp; but when i run this program in sas&amp;nbsp;i got 15 as length for the variable first .&amp;nbsp;can you help me out in this case though i know length of scan function is 200 .&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 17:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/469310#M120022</guid>
      <dc:creator>sanyam13</dc:creator>
      <dc:date>2018-06-11T17:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/469316#M120027</link>
      <description>&lt;P&gt;Hi Sanyam,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From what I remember, if the destination variable does not have a specified length, SAS will set it to the length of the source.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Small test:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data toto;
  length a $200.;
  a = 'Hello World!';
  b = 'Hello World!';
  c = scan(a, 1, ' ');
  d = scan(b, 1, ' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c has length 200 and d has length 15.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I assume in the question the was something indicating the length of author.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 17:21:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/469316#M120027</guid>
      <dc:creator>ybolduc</dc:creator>
      <dc:date>2018-06-11T17:21:37Z</dc:date>
    </item>
  </channel>
</rss>

