<?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 Reg:SCAN in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44601#M9129</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;if it is having 5 words and length &amp;lt;10 and length greate than 200&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually,I do not understand what you mean.&lt;/P&gt;&lt;P&gt;Since you want length&amp;lt;10 ,why do you need &amp;gt; 200 ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data l;
infile cards&amp;nbsp; truncover;
input add $ 1-100;
cards;
q w e r t y
r t t t t
qwerret w a d f g g
run;
data l2;
 set l;
 length add_QC1 $ 100;
 if countw(add) eq 5 and LENGTH(COMPRESS(add, ' ') ) &amp;lt;10 or&amp;nbsp; 
 LENGTH(COMPRESS(add, ' ')) &amp;gt;200 then add_QC1=' ';
 else add_QC1=add;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Mar 2012 06:26:11 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-03-28T06:26:11Z</dc:date>
    <item>
      <title>Reg:SCAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44596#M9124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data l; infile cards missover truncover; input add $ 1-100; cards; q w e r t y r t t t qwerret w a d f g g run; data l2; set l; if (SCAN(add,5,' ') EQ '' |&amp;nbsp; LENGTH(COMPRESS(add, ' ') ) &amp;lt;10 | LENGTH(COMPRESS(add, ' ')) &amp;gt;200) then do; add_QC1 =''; add_QC2 =''; add_QC3 = ''; end; else do; add_QC1 = add ; add_QC2 = ''; add_QC3 = '' ; end; run; Actually i am checking if it is having 5 words and length &amp;lt;10 and length greate than 200 i want the output to be : obs add&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add_QC1 ---&amp;nbsp; --- 1.&amp;nbsp; q w e r t y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q w e r t y 2.&amp;nbsp; r t t t 3.&amp;nbsp; qwerret w a d f g g&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; qwerret w a d f g g&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 11:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44596#M9124</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2012-03-27T11:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reg:SCAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44597#M9125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can check the text file for you ref as the above is not fine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 11:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44597#M9125</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2012-03-27T11:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reg:SCAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44598#M9126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;R_Win,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are several features of your program to either correct or clarify.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, do not use both TRUNCOVER and MISSOVER.&amp;nbsp; Pick one or the other.&amp;nbsp; My choice would be neither, but to use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;infile cards lrecl=100 pad;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you want to read 100 characters from the data lines, make sure you have 100 characters to read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second, you say you want three conditions to be met, using AND to join the three conditions.&amp;nbsp; But the code uses | which means OR.&amp;nbsp; I suspect you actually mean OR, since it is not possible for the length to be both less than 10 and greater than 200.&amp;nbsp; But perhaps it is some combination of AND and OR.&amp;nbsp; You need to clarify the conditions you want to meet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Third, since your program reads 100 characters as the value for ADD, it is not possible for the length to be greater than 200.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, the statement add_QC1=''; defines add_QC1 as being 1 character long.&amp;nbsp; If the later statement executes (add_QC1 = add;), there is not enough room to store the full value of ADD.&amp;nbsp; Instead, it will be truncated down to a single character.&amp;nbsp; The easiest solution is to add a LENGTH statement toward the beginning of the DATA step, defining ADD_QC1 as being 100 characters long.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Patch up this much, and we'll see if the questions remain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 13:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44598#M9126</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-03-27T13:18:16Z</dc:date>
    </item>
    <item>
      <title>Reg:SCAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44599#M9127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if (SCAN(add,5,' ') EQ ' ' Actually i want the info for this is meas it will scan the word having 5 words separated by spaces is it correct&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 14:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44599#M9127</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2012-03-27T14:12:37Z</dc:date>
    </item>
    <item>
      <title>Reg:SCAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44600#M9128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;R_Win,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That statement is checking that ADD contains fewer than 5 words (using blanks as delimiters).&amp;nbsp; The SCAN function returns a blank when it searches for a fifth word and doesn't find one.&amp;nbsp; A few more variations ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To find ADD with at least 5 words:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if SCAN(add, 5, ' ') &amp;gt; ' ' then ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To find ADD with exactly 5 words:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if SCAN(add, 5, ' ') &amp;gt; ' ' and scan(add, 6, ' ') = ' ' then ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 14:20:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44600#M9128</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-03-27T14:20:20Z</dc:date>
    </item>
    <item>
      <title>Reg:SCAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44601#M9129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;if it is having 5 words and length &amp;lt;10 and length greate than 200&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually,I do not understand what you mean.&lt;/P&gt;&lt;P&gt;Since you want length&amp;lt;10 ,why do you need &amp;gt; 200 ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data l;
infile cards&amp;nbsp; truncover;
input add $ 1-100;
cards;
q w e r t y
r t t t t
qwerret w a d f g g
run;
data l2;
 set l;
 length add_QC1 $ 100;
 if countw(add) eq 5 and LENGTH(COMPRESS(add, ' ') ) &amp;lt;10 or&amp;nbsp; 
 LENGTH(COMPRESS(add, ' ')) &amp;gt;200 then add_QC1=' ';
 else add_QC1=add;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2012 06:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reg-SCAN/m-p/44601#M9129</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-28T06:26:11Z</dc:date>
    </item>
  </channel>
</rss>

