<?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: Array Code in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134021#M36358</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Reeza indicated, you would do well to learn the ELSE statement.&amp;nbsp; But your problem lies in another area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You only have 1 variable you are setting, but you examine 35 diagnosis codes.&amp;nbsp; What should happen if dx1='427.31' and dx2='427.32' and dx3='555'?&amp;nbsp; That's not a programming issue, that's a matter of thinking through the result you would like to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each time through your DO loop, you overwrite the value of your new variable.&amp;nbsp; So in your code, dx35 is the only one that matters.&amp;nbsp; Its value is the only one determining your new variable.&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>Mon, 13 May 2013 20:07:33 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2013-05-13T20:07:33Z</dc:date>
    <item>
      <title>Array Code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134019#M36356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;&lt;P&gt;I also want to include a condition that if any of the these codes are not present then Arrhythemia='None';&lt;/P&gt;&lt;P&gt;I tried to use NOT IN condition and i dont get it right??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you help resolve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 19:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134019#M36356</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-05-13T19:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Array Code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134020#M36357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to look up if/else if/else operations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data diag_array;&lt;/P&gt;&lt;P&gt;set daig_cohort;&lt;/P&gt;&lt;P&gt;array diag(50) dx1-dx50;&lt;/P&gt;&lt;P&gt;do i=1 to 35;&lt;/P&gt;&lt;P&gt;if diag(i) EQ '427.31' THEN Arrhythemia='flu1';&lt;/P&gt;&lt;P&gt;else if diag(i) EQ '427.32' THEN Arrhythemia='flu2';&lt;/P&gt;&lt;P&gt;else if diag(i) in('427','427.0','427.2','427.3','427.60', '427.61', '427.8', '427.81', '427.89', '427.9') THEN Arrhythemia='Other';&lt;/P&gt;&lt;P&gt;else &lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;Arrhythemia='None'; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 19:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134020#M36357</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-05-13T19:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Array Code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134021#M36358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Reeza indicated, you would do well to learn the ELSE statement.&amp;nbsp; But your problem lies in another area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You only have 1 variable you are setting, but you examine 35 diagnosis codes.&amp;nbsp; What should happen if dx1='427.31' and dx2='427.32' and dx3='555'?&amp;nbsp; That's not a programming issue, that's a matter of thinking through the result you would like to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each time through your DO loop, you overwrite the value of your new variable.&amp;nbsp; So in your code, dx35 is the only one that matters.&amp;nbsp; Its value is the only one determining your new variable.&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>Mon, 13 May 2013 20:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134021#M36358</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-05-13T20:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Array Code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134022#M36359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Responding to your original code, looks like you would like to parse across 50 columns(diag) and thru 1000 rosw to set condition for Arrhythemia.&lt;/P&gt;&lt;P&gt;Heres my quick solution. Giv it a shot -&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data diag_array;&lt;BR /&gt;&amp;nbsp; set daig_cohort;&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; eligdiag = 0;&lt;BR /&gt;&amp;nbsp; array diag(50) dx1-dx50;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 50;&lt;BR /&gt; IF diag(i) EQ '427.31' THEN DO;&lt;BR /&gt;&amp;nbsp; eligdiag = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Arrhythemia='flu1';&lt;BR /&gt; END;&lt;/P&gt;&lt;P&gt; ELSE IF diag EQ '427.32' THEN Arrhythemia='flu2' THEN DO;&lt;BR /&gt;&amp;nbsp; eligdiag = 1;&lt;BR /&gt;&amp;nbsp; Arrhythemia='flu2';&lt;BR /&gt; END;&lt;/P&gt;&lt;P&gt; ELSE IF diag in('427','427.0','427.2','427.3','427.60', '427.61', '427.8', '427.81', '427.89', '427.9') THEN DO;&lt;BR /&gt;&amp;nbsp; eligdiag = 1;&lt;BR /&gt;&amp;nbsp; Arrhythemia='Other';&lt;BR /&gt; END; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE DO; &lt;BR /&gt;&amp;nbsp; eligdiag = 0;&lt;BR /&gt;&amp;nbsp; Arrhythemia='None'; &lt;BR /&gt; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF eligdiag = 1 then leave;&lt;BR /&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DROP eligdiag;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;the LEAVE statement is the key here.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;Gud Luk!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 21:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Code/m-p/134022#M36359</guid>
      <dc:creator>sascom10</dc:creator>
      <dc:date>2013-05-13T21:33:08Z</dc:date>
    </item>
  </channel>
</rss>

