<?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: Creating a counter variable for certain conditions within an array in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582928#M34550</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID    (Diag1    Diag2    Diag3    Diag4    Diag5) ($)  ;
cards;
1     T401      B403     C005     D054       F403                   
2     B504      F05       L094     M504       N093                  
3     LT409      G056    M095     X09          Y06  
;

data want;
set have;
array t diag1-diag5;
Counter=0;
do over t;
 if first(t) in ('T','F') then Counter=sum(Counter,1);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 21 Aug 2019 18:13:13 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-08-21T18:13:13Z</dc:date>
    <item>
      <title>Creating a counter variable for certain conditions within an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582917#M34545</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a very large data set which looks similar to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID&amp;nbsp; &amp;nbsp; Diag1&amp;nbsp; &amp;nbsp; Diag2&amp;nbsp; &amp;nbsp; Diag3&amp;nbsp; &amp;nbsp; Diag4&amp;nbsp; &amp;nbsp; Diag5&amp;nbsp; &amp;nbsp;etc...&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;T401&amp;nbsp; &amp;nbsp; &amp;nbsp; B403&amp;nbsp; &amp;nbsp; &amp;nbsp;C005&amp;nbsp; &amp;nbsp; &amp;nbsp;D054&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F403&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;B504&amp;nbsp; &amp;nbsp; &amp;nbsp; F05&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;L094&amp;nbsp; &amp;nbsp; &amp;nbsp;M504&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N093&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;LT409&amp;nbsp; &amp;nbsp; &amp;nbsp; G056&amp;nbsp; &amp;nbsp; M095&amp;nbsp; &amp;nbsp; &amp;nbsp;X09&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y06&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use an array to create a counter variable to count the number of times a record has a "T" or&amp;nbsp; "F" diagnosis, like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID&amp;nbsp; &amp;nbsp; Diag1&amp;nbsp; &amp;nbsp; Diag2&amp;nbsp; &amp;nbsp; Diag3&amp;nbsp; &amp;nbsp; Diag4&amp;nbsp; &amp;nbsp; Diag5&amp;nbsp; &amp;nbsp;etc...&amp;nbsp; Counter&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;EM&gt;T401&lt;/EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; B403&amp;nbsp; &amp;nbsp; &amp;nbsp;C005&amp;nbsp; &amp;nbsp; &amp;nbsp;D054&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;EM&gt;&amp;nbsp;F403&lt;/EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;B504&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;EM&gt;F05&lt;/EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;L094&amp;nbsp; &amp;nbsp; &amp;nbsp;M504&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N093&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; LT409&amp;nbsp; &amp;nbsp; &amp;nbsp; G056&amp;nbsp; &amp;nbsp; M095&amp;nbsp; &amp;nbsp; &amp;nbsp;X09&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I know how to code an array, but I'm not sure how to incorporate the counter. Here's what I have for my array code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data base;&lt;BR /&gt;set base;&lt;BR /&gt;array DIAG{25} $7 DIAG1 - DIAG25;&lt;BR /&gt;array DIAGTY{25} $1 DIAGTY1 - DIAGTY25;&lt;BR /&gt;do i=01 to 25;&lt;BR /&gt;if substr(DIAG(i),1,3) in ('T36') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T37') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T38') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T39') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T400') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T401') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T402') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T403') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T404') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T405') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T406') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T408') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T409') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T41') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T42') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T43') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T44') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T45') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T46') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T47') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T48') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T49') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T50') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T51') or&lt;/P&gt;&lt;P&gt;substr(DIAG(i),1,4) in ('F100') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F110') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F130') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F140') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F150') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F160') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F170') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F180') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F190')&lt;/P&gt;&lt;P&gt;then do; count=1; end;&amp;nbsp; &amp;nbsp;/*What can I put here to get it to count the number of times these codes appear in each record?*/&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 17:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582917#M34545</guid>
      <dc:creator>sas_newbie14</dc:creator>
      <dc:date>2019-08-21T17:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a counter variable for certain conditions within an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582920#M34546</link>
      <description>&lt;P&gt;Does this&amp;nbsp;&lt;SPAN&gt;L&lt;STRONG&gt;T&lt;/STRONG&gt;409&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;not qualify?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 17:58:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582920#M34546</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-21T17:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a counter variable for certain conditions within an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582923#M34547</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data base2;
set base;
array DIAG{25} $7 DIAG1 - DIAG25;
array DIAGTY{25} $1 DIAGTY1 - DIAGTY25;
counter=0;
do i=01 to 25;
if substr(DIAG(i),1,3) in ('T36') then counter=counter+1;
if substr(DIAG(i),1,3) in ('T37') then counter=counter+1;
if substr(DIAG(i),1,3) in ('T38') then counter=counter+1;
if substr(DIAG(i),1,3) in ('T39') then counter=counter+1;
/* etc. */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582923#M34547</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-21T18:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a counter variable for certain conditions within an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582924#M34548</link>
      <description>&lt;P&gt;No, it does not qualify. Only codes with the Prefix of T or F. Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:06:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582924#M34548</guid>
      <dc:creator>sas_newbie14</dc:creator>
      <dc:date>2019-08-21T18:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a counter variable for certain conditions within an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582927#M34549</link>
      <description>&lt;P&gt;Use a loop with your array and SUBSTR() to get the first character of each code and check if that's a T or F.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;

array diag(25) $7 diag1-diag25;

counter = 0;

do i=1 to dim(diag);
       if upcase(substr(diag(1), 1, 1)) in ('T', 'F') then counter+1;
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;LI-SPOILER&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286058"&gt;@sas_newbie14&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a very large data set which looks similar to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ID&amp;nbsp; &amp;nbsp; Diag1&amp;nbsp; &amp;nbsp; Diag2&amp;nbsp; &amp;nbsp; Diag3&amp;nbsp; &amp;nbsp; Diag4&amp;nbsp; &amp;nbsp; Diag5&amp;nbsp; &amp;nbsp;etc...&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;T401&amp;nbsp; &amp;nbsp; &amp;nbsp; B403&amp;nbsp; &amp;nbsp; &amp;nbsp;C005&amp;nbsp; &amp;nbsp; &amp;nbsp;D054&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F403&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;B504&amp;nbsp; &amp;nbsp; &amp;nbsp; F05&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;L094&amp;nbsp; &amp;nbsp; &amp;nbsp;M504&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N093&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;LT409&amp;nbsp; &amp;nbsp; &amp;nbsp; G056&amp;nbsp; &amp;nbsp; M095&amp;nbsp; &amp;nbsp; &amp;nbsp;X09&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y06&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to use an array to create a counter variable to count the number of times a record has a "T" or&amp;nbsp; "F" diagnosis, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ID&amp;nbsp; &amp;nbsp; Diag1&amp;nbsp; &amp;nbsp; Diag2&amp;nbsp; &amp;nbsp; Diag3&amp;nbsp; &amp;nbsp; Diag4&amp;nbsp; &amp;nbsp; Diag5&amp;nbsp; &amp;nbsp;etc...&amp;nbsp; Counter&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;EM&gt;T401&lt;/EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; B403&amp;nbsp; &amp;nbsp; &amp;nbsp;C005&amp;nbsp; &amp;nbsp; &amp;nbsp;D054&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;EM&gt;&amp;nbsp;F403&lt;/EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;B504&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;EM&gt;F05&lt;/EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;L094&amp;nbsp; &amp;nbsp; &amp;nbsp;M504&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N093&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; LT409&amp;nbsp; &amp;nbsp; &amp;nbsp; G056&amp;nbsp; &amp;nbsp; M095&amp;nbsp; &amp;nbsp; &amp;nbsp;X09&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I know how to code an array, but I'm not sure how to incorporate the counter. Here's what I have for my array code:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data base;&lt;BR /&gt;set base;&lt;BR /&gt;array DIAG{25} $7 DIAG1 - DIAG25;&lt;BR /&gt;array DIAGTY{25} $1 DIAGTY1 - DIAGTY25;&lt;BR /&gt;do i=01 to 25;&lt;BR /&gt;if substr(DIAG(i),1,3) in ('T36') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T37') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T38') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T39') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T400') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T401') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T402') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T403') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T404') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T405') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T406') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T408') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('T409') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T41') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T42') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T43') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T44') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T45') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T46') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T47') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T48') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T49') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T50') or&lt;BR /&gt;substr(DIAG(i),1,3) in ('T51') or&lt;/P&gt;
&lt;P&gt;substr(DIAG(i),1,4) in ('F100') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F110') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F130') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F140') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F150') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F160') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F170') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F180') or&lt;BR /&gt;substr(DIAG(i),1,4) in ('F190')&lt;/P&gt;
&lt;P&gt;then do; count=1; end;&amp;nbsp; &amp;nbsp;/*What can I put here to get it to count the number of times these codes appear in each record?*/&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582927#M34549</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T18:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a counter variable for certain conditions within an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582928#M34550</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID    (Diag1    Diag2    Diag3    Diag4    Diag5) ($)  ;
cards;
1     T401      B403     C005     D054       F403                   
2     B504      F05       L094     M504       N093                  
3     LT409      G056    M095     X09          Y06  
;

data want;
set have;
array t diag1-diag5;
Counter=0;
do over t;
 if first(t) in ('T','F') then Counter=sum(Counter,1);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582928#M34550</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-21T18:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a counter variable for certain conditions within an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582930#M34551</link>
      <description>&lt;P&gt;Stand back! This is a job for SUPER PROCTRANSPOSE!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make your life easier, convert your diagnosis values into a column, and then you can apply any tests you wish.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=Have;
	by ID;
run;

proc transpose data=Have out=HaveTransposed;
	var Diag1-Diag5;
	by ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582930#M34551</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2019-08-21T18:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a counter variable for certain conditions within an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582931#M34552</link>
      <description>&lt;P&gt;That worked perfectly, thanks a million &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-counter-variable-for-certain-conditions-within-an/m-p/582931#M34552</guid>
      <dc:creator>sas_newbie14</dc:creator>
      <dc:date>2019-08-21T18:21:42Z</dc:date>
    </item>
  </channel>
</rss>

