<?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: Look up in array to identify a specific value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632917#M187702</link>
    <description>Very useful function it is.  Thank you!</description>
    <pubDate>Wed, 18 Mar 2020 11:37:00 GMT</pubDate>
    <dc:creator>Cruise</dc:creator>
    <dc:date>2020-03-18T11:37:00Z</dc:date>
    <item>
      <title>Look up in array to identify a specific value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632914#M187700</link>
      <description>&lt;P&gt;HI Folks:&lt;/P&gt;
&lt;P&gt;I'm trying to identify cases based on the array which consists of 25 variables initialized with DX in my data. The variable IDENTIFIED is the correct answer in the HAVE data where the IDENTIFIED variable correctly captured value of '157' in any variable of the array. In other words, all DX01-DX03 are diagnoses and any of this series of variables can indicate the diagnosis (157 by ICD-9) that I'm looking up to identify.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your time in advance.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  input DX01 $ DX02 $ DX03 $ IDENTIFIED;
cards;
157 157 200 1
157 200 100 1
100 157 100 1
;
data WANT; set HAVE;
  array DXIN [3] DX01-DX03;
  do I = 1 to dim(DXIN);
	 IDENTIFY=DXIN[I]='157';
  end;
  drop I; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 11:28:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632914#M187700</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-03-18T11:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Look up in array to identify a specific value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632916#M187701</link>
      <description>&lt;P&gt;Take a look at the Whichc Function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  input DX01 $ DX02 $ DX03 $;
cards;
157 157 200
157 200 100
100 157 100
100 100 100
;

data WANT; 
  set HAVE;
  array DXIN [3] DX01-DX03;
  identify = whichc('157', of DXIN[*]) &amp;gt; 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Mar 2020 11:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632916#M187701</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-03-18T11:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Look up in array to identify a specific value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632917#M187702</link>
      <description>Very useful function it is.  Thank you!</description>
      <pubDate>Wed, 18 Mar 2020 11:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632917#M187702</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-03-18T11:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Look up in array to identify a specific value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632918#M187703</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp; Good morning, This is a nice scenario to utilize a Boolean (1,0) operation using the IN operator. IN works typically like a check function/method&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  input DX01 $ DX02 $ DX03 $ IDENTIFIED;
cards;
157 157 200 1
157 200 100 1
100 157 100 1
;

data want;
 set have;
 array t DX01- DX03;
 IDENTIFY='157' in t;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If value in array then return 1 else return 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 11:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632918#M187703</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-18T11:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Look up in array to identify a specific value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632925#M187705</link>
      <description>Thanks a lot. I ended up using IN function.</description>
      <pubDate>Wed, 18 Mar 2020 11:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Look-up-in-array-to-identify-a-specific-value/m-p/632925#M187705</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-03-18T11:52:09Z</dc:date>
    </item>
  </channel>
</rss>

