<?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: How SAS run with multiuple arrays in one datastep? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733178#M228476</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your introduction about "eit", I did a search from google and lexjansen but no document available for me to read about that, could you please suggest me a document or else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Apr 2021 02:13:42 GMT</pubDate>
    <dc:creator>Phil_NZ</dc:creator>
    <dc:date>2021-04-13T02:13:42Z</dc:date>
    <item>
      <title>How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733153#M228465</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Today I want to exclude the stock in specific countries with ENAME contains some characters, my code is as below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data filter_each_country;
 set concatenate_;
  array delwords1 {18} $ 15 _temporary_ ('PN' 'PNA' 'PNB' 'PNC' 'PND' 'PNE' 'PNF'
'PNG' 'RCSA' 'RCTB' 'PNDEAD' 'PNADEAD' 'PNBDEAD' 'PNCDEAD' 'PNDDEAD' 'PNEDEAD' 'PNFDEAD' 'PNGDEAD');
   do i= 1 to dim(delwords1);
    if GEOGN ='BRAZIL' and findw(ENAME,delwords1[i],'','eir') &amp;gt;0 then delete;
   end;

  array delwords2 {3} $ 15 _temporary_ ('PFCL' 'PRIVILEGIADAS' 'PRVLG');
   do i= 1 to dim(delwords2);
    if GEOGN ='COLOMBIA' and findw(ENAME,delwords2[i],'','eir') &amp;gt;0 then delete;
   end;
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The code is built based on my understanding: the code above runs through the first whole loop and delete the observation satisfying both conditions: having &lt;STRONG&gt;GEOGN='BRAZIL'&lt;/STRONG&gt; and ENAME contains the words in array &lt;STRONG&gt;delwords1&lt;/STRONG&gt;. Afterwards, SAS will start from observation 1 and run through the whole second loop and delete the observation satisfying both conditions: having &lt;STRONG&gt;GEOGN='COLOMBIA'&lt;/STRONG&gt; and ENAME contains the words in array &lt;STRONG&gt;delwords2&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am wondering if I fall into any fallacy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you and warm regards.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 00:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733153#M228465</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-04-13T00:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733169#M228467</link>
      <description>&lt;P&gt;Not exactly.&lt;/P&gt;
&lt;P&gt;SAS will read observation 1 and assess whether it should be deleted, using all the tests you have programmed. Then it goes to obs 2 and does the same. It never goes back to obs 1.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 01:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733169#M228467</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-13T01:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733170#M228469</link>
      <description>&lt;P&gt;Note that you can improve speed a bit by using modifiers &lt;EM&gt;eit&lt;/EM&gt; instead or &lt;EM&gt;eir&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 01:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733170#M228469</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-13T01:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733171#M228470</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, you mean that the first observation will go through all the loops until being deleted, if not it will be read implicitly (if there is no explicit output) at the end, and then the second observation will follow the same pattern.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 01:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733171#M228470</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-04-13T01:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733173#M228471</link>
      <description>&lt;P&gt;I don't know what you are wondering about, is there a problem?&lt;BR /&gt;Also, I don't know what the value of ENAME is, but it looks like it could be rewritten like this, what do you think?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data filter_each_country;
  set concatenate_;
  array delwords1 {18} $ 15 _temporary_ ('PN' 'PNA' 'PNB' 'PNC' 'PND' 'PNE' 'PNF' 'PNG' 'RCSA' 'RCTB' 'PNDEAD' 'PNADEAD' 'PNBDEAD' 'PNCDEAD' 'PNDDEAD' 'PNEDEAD' 'PNFDEAD' 'PNGDEAD');
  array delwords2 {3} $ 15 _temporary_ ('PFCL' 'PRIVILEGIADAS' 'PRVLG');
  if (GEOGN ='BRAZIL'   and upcase(ENAME) in delwords1) or
     (GEOGN ='COLOMBIA' and upcase(ENAME) in delwords2) then delete;
 run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code does not use a do loop on the array, but uses in operator.&lt;BR /&gt;Since in operator detects word matches, it is not exactly the same as the findw function,&lt;/P&gt;
&lt;P&gt;but since the array was set with duplicate characters such as "PN", "PNA", etc., I decided that it would be possible.&lt;BR /&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 01:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733173#M228471</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-04-13T01:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733175#M228473</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; So, you mean that the first observation will go through all the loops until being deleted, if not it will be read implicitly (if there is no explicit output) at the end, and then the second observation will follow the same pattern.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rather: the first observation will go through all the loops until being deleted, if not it will be &lt;STRONG&gt;&lt;EM&gt;written out&lt;/EM&gt; &lt;/STRONG&gt;implicitly (if there is no explicit output) at the end, and then the second observation will follow the same pattern.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 02:03:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733175#M228473</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-13T02:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733176#M228474</link>
      <description>&lt;P&gt;That's not the same thing at all.&amp;nbsp; findw() looks for a partial match, while your second test using upcase() looks for a full match of the string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was saying that modifier &lt;EM&gt;eit&lt;/EM&gt; trims all strings in the expression, thus making the search for a match faster then simply using &lt;EM&gt;eir&lt;/EM&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 02:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733176#M228474</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-13T02:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733177#M228475</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226565"&gt;@japelin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply, the ENAME is as below (I show the deleted items)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;TYPE	ENAME
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
772941	STOCKMANN AF DEAD 04/01/93 USE 946148
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR
50879M	GMA HOLDINGS PDR&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;based on the filtered code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data concatenate_ ;
	set work.concatenatex;
	where indc3 not in ('NA' 'UNCLS' 'UQEQS' 'OTHEQ');

	if (GEOGN ='PHILIPPINES' and findw(ENAME,'PDR','','eir') &amp;gt;0)
		or
		(GEOGN ='FINLAND' and findw(ENAME,'USE','','eir') &amp;gt;0)
		or
		(GEOGN ='NEWZEALAND' and findw(ENAME,'RTS','','eir') &amp;gt;0) then
		DELETE;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Warm regards,&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 02:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733177#M228475</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-04-13T02:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733178#M228476</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your introduction about "eit", I did a search from google and lexjansen but no document available for me to read about that, could you please suggest me a document or else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 02:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733178#M228476</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-04-13T02:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733180#M228478</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; Thank you very much for your introduction about "eit",&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Look at the t modifier for function &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p16rdsa30vmm43n1ej4936nwa01t.htm&amp;amp;locale=en" target="_self"&gt;findw()&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 02:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733180#M228478</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-13T02:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: How SAS run with multiuple arrays in one datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733193#M228485</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is hard to say without checking what the value to be deleted looks like.&lt;/P&gt;
&lt;P&gt;If it "contains a word" specified in the array, then you need findw, and if it "matches a character" specified in the array, then you can use in operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's take the case of "GEOGN ='COLOMBIA'" as an example.&lt;BR /&gt;If the value of ENAME is "PFCL XXX", findw will return &amp;gt;0, but in operator will return false.&lt;BR /&gt;If the value of ENAME is "PFCL", findw will return &amp;gt;0, and in operator will return true, so it can be rewritten.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, please don't multi-post.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 03:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-SAS-run-with-multiuple-arrays-in-one-datastep/m-p/733193#M228485</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-04-13T03:32:19Z</dc:date>
    </item>
  </channel>
</rss>

