<?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: Getting Counts in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542148#M149802</link>
    <description>&lt;P&gt;Example starting data and what the result should look like are helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you mean that you have 25 other values that occur in the array ARRAY_IC I would likely put them into a temporary array and use the WHICHC function to search the temporary array for each value in the array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data pacemaker1617;
   set cihi.dad1617;
   ARRAY ARRAY_IC [20] INTERV_CODE_01- INTERV_CODE_20;
   array t [4] $ 10 _temporary_ ( '1YY55LANM' '1ZZ55LANZ' '1XX55LANX' '1QQ55LANQ');
   if PROVINCE_ISSUING_HCN='ON' and RESPONSIBILITY_FOR_PAYMENT='01' and HCN_INDEX='H'
   and AGE &amp;gt;=18 ;
   DO I=1 TO 20;
   IF whichc(ARRAY_IC[I], of t(*) )&amp;gt;0 THEN output;

   END;
RUN;&lt;/PRE&gt;
&lt;P&gt;I picked 10 as the length of the elements to allow the string value of the code to be a little longer than the displayed one. If your lengths vary more than make sure the length in the array definition is large enough.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This presumes that if a value of the code in ARRAY_IC is duplicated it should create duplicate outputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Mar 2019 17:51:24 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-03-11T17:51:24Z</dc:date>
    <item>
      <title>Getting Counts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542126#M149792</link>
      <description>&lt;P&gt;data pacemaker1617;&lt;BR /&gt;set cihi.dad1617;&lt;BR /&gt;ARRAY ARRAY_IC [20] INTERV_CODE_01- INTERV_CODE_20;&lt;BR /&gt;if PROVINCE_ISSUING_HCN='ON' and RESPONSIBILITY_FOR_PAYMENT='01' and HCN_INDEX='H'&lt;BR /&gt;and AGE &amp;gt;=18 ;&lt;BR /&gt;DO I=1 TO 20;&lt;BR /&gt;&lt;BR /&gt;IF ARRAY_IC[I] in ('1YY55LANM') THEN output;&lt;BR /&gt;&lt;BR /&gt;END;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 25 more codes for which I need to create data extracts similar to the way done above&lt;/P&gt;&lt;P&gt;What would be an easy way to modify the code above to do the same&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 17:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542126#M149792</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2019-03-11T17:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Counts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542133#M149795</link>
      <description>&lt;P&gt;Your code will create up to 20 identical copies per observation. Is this intended?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 17:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542133#M149795</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-11T17:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Counts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542145#M149799</link>
      <description>&lt;P&gt;The intent is to count a record if the code occurs in any one of the 20 fields which is what the code is doing&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I want to understand if there is an easier way to create an extract for 25 different codes&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 17:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542145#M149799</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2019-03-11T17:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Counts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542146#M149800</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240770"&gt;@Ranjeeta&lt;/a&gt;&amp;nbsp; I think you are prolly after this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data pacemaker1617;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set cihi.dad1617;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ARRAY ARRAY_IC [20] INTERV_CODE_01- INTERV_CODE_20;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if PROVINCE_ISSUING_HCN='ON' and RESPONSIBILITY_FOR_PAYMENT='01' and HCN_INDEX='H'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and AGE &amp;gt;=18 ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;if&amp;nbsp; '1YY55LANM' in&amp;nbsp;ARRAY_IC then output;&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 17:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542146#M149800</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-03-11T17:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Counts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542148#M149802</link>
      <description>&lt;P&gt;Example starting data and what the result should look like are helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you mean that you have 25 other values that occur in the array ARRAY_IC I would likely put them into a temporary array and use the WHICHC function to search the temporary array for each value in the array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data pacemaker1617;
   set cihi.dad1617;
   ARRAY ARRAY_IC [20] INTERV_CODE_01- INTERV_CODE_20;
   array t [4] $ 10 _temporary_ ( '1YY55LANM' '1ZZ55LANZ' '1XX55LANX' '1QQ55LANQ');
   if PROVINCE_ISSUING_HCN='ON' and RESPONSIBILITY_FOR_PAYMENT='01' and HCN_INDEX='H'
   and AGE &amp;gt;=18 ;
   DO I=1 TO 20;
   IF whichc(ARRAY_IC[I], of t(*) )&amp;gt;0 THEN output;

   END;
RUN;&lt;/PRE&gt;
&lt;P&gt;I picked 10 as the length of the elements to allow the string value of the code to be a little longer than the displayed one. If your lengths vary more than make sure the length in the array definition is large enough.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This presumes that if a value of the code in ARRAY_IC is duplicated it should create duplicate outputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 17:51:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-Counts/m-p/542148#M149802</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-11T17:51:24Z</dc:date>
    </item>
  </channel>
</rss>

