<?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 and findw function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/scan-and-findw-function/m-p/391128#M93890</link>
    <description>&lt;P&gt;In SAS data sets, variables have a fixed length. &amp;nbsp;That length does not change from one observation to the next. &amp;nbsp;Therefore ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you assign a value to A, SAS defines A as character, with a length of 20. &amp;nbsp;It is possible that 20 characters would be needed to store A, so that's the length assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly, when you define D, SAS defines it as character with a length of 20. &amp;nbsp;Again, it is possible that 20 characters would be needed to store its value, so that's the length assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When the TRIM function executes, it does remove trailing blanks. &amp;nbsp;However, the result gets stored in a variable that is defined as 20 characters long, so any blanks that were removed by TRIM get added back on again. &amp;nbsp;As a result, FINDW cannot find that 20-character string with all those trailing blanks. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To remedy the situation, try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;c = findw(date_info, trim(a));&lt;/P&gt;</description>
    <pubDate>Sun, 27 Aug 2017 15:14:31 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-08-27T15:14:31Z</dc:date>
    <item>
      <title>scan and findw function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-and-findw-function/m-p/391127#M93889</link>
      <description>&lt;P&gt;data One;&lt;BR /&gt;input Date_Info $ 20.;&lt;BR /&gt;cards;&lt;BR /&gt;24Nov is Sunday&lt;BR /&gt;25Nov is Monday&lt;BR /&gt;26Nov is Tuesday&lt;BR /&gt;27Nov is Wednesday&lt;BR /&gt;28NOV IS THURSDAY&lt;BR /&gt;29nov is Friday&lt;BR /&gt;30NOV is SATURDAY&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data two;&lt;BR /&gt;set one;&lt;BR /&gt;a=scan(date_info,-1);&lt;BR /&gt;put a;&lt;BR /&gt;d=trim(a);&lt;BR /&gt;c=findw(date_info,d);&lt;BR /&gt;put c;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Iam writing this code it giving c as zero always why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Aug 2017 14:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-and-findw-function/m-p/391127#M93889</guid>
      <dc:creator>himanshu1</dc:creator>
      <dc:date>2017-08-27T14:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: scan and findw function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-and-findw-function/m-p/391128#M93890</link>
      <description>&lt;P&gt;In SAS data sets, variables have a fixed length. &amp;nbsp;That length does not change from one observation to the next. &amp;nbsp;Therefore ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you assign a value to A, SAS defines A as character, with a length of 20. &amp;nbsp;It is possible that 20 characters would be needed to store A, so that's the length assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly, when you define D, SAS defines it as character with a length of 20. &amp;nbsp;Again, it is possible that 20 characters would be needed to store its value, so that's the length assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When the TRIM function executes, it does remove trailing blanks. &amp;nbsp;However, the result gets stored in a variable that is defined as 20 characters long, so any blanks that were removed by TRIM get added back on again. &amp;nbsp;As a result, FINDW cannot find that 20-character string with all those trailing blanks. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To remedy the situation, try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;c = findw(date_info, trim(a));&lt;/P&gt;</description>
      <pubDate>Sun, 27 Aug 2017 15:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-and-findw-function/m-p/391128#M93890</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-27T15:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: scan and findw function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-and-findw-function/m-p/391129#M93891</link>
      <description>&lt;P&gt;thanks alot for explaining the logic. now im able to uderstand the flow how its going. once again thank you.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Aug 2017 15:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-and-findw-function/m-p/391129#M93891</guid>
      <dc:creator>himanshu1</dc:creator>
      <dc:date>2017-08-27T15:18:36Z</dc:date>
    </item>
  </channel>
</rss>

