<?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 How to achieve array function by using SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-achieve-array-function-by-using-SQL/m-p/13016#M1484</link>
    <description>Hi, pros:&lt;BR /&gt;
&lt;BR /&gt;
I have &lt;BR /&gt;
&lt;BR /&gt;
data1:  with a variable (Destination) with several values (123, 281, ...) ;&lt;BR /&gt;
data2:  structure as follows&lt;BR /&gt;
id  Des1 Des2 Des3&lt;BR /&gt;
1   123  234    233&lt;BR /&gt;
1   234  281    341&lt;BR /&gt;
2  ....&lt;BR /&gt;
&lt;BR /&gt;
Goal: if a person goes to any one of Destination by looking at 3 field of  Des1, Des2, Des3, I would like to subset.&lt;BR /&gt;
&lt;BR /&gt;
I can do it by using array and macro.&lt;BR /&gt;
&lt;BR /&gt;
Do you think SQL can do a better job? If so, how. Please advise. Thanks.&lt;BR /&gt;
&lt;BR /&gt;
Tulip.</description>
    <pubDate>Fri, 06 Nov 2009 03:28:04 GMT</pubDate>
    <dc:creator>tulip</dc:creator>
    <dc:date>2009-11-06T03:28:04Z</dc:date>
    <item>
      <title>How to achieve array function by using SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-achieve-array-function-by-using-SQL/m-p/13016#M1484</link>
      <description>Hi, pros:&lt;BR /&gt;
&lt;BR /&gt;
I have &lt;BR /&gt;
&lt;BR /&gt;
data1:  with a variable (Destination) with several values (123, 281, ...) ;&lt;BR /&gt;
data2:  structure as follows&lt;BR /&gt;
id  Des1 Des2 Des3&lt;BR /&gt;
1   123  234    233&lt;BR /&gt;
1   234  281    341&lt;BR /&gt;
2  ....&lt;BR /&gt;
&lt;BR /&gt;
Goal: if a person goes to any one of Destination by looking at 3 field of  Des1, Des2, Des3, I would like to subset.&lt;BR /&gt;
&lt;BR /&gt;
I can do it by using array and macro.&lt;BR /&gt;
&lt;BR /&gt;
Do you think SQL can do a better job? If so, how. Please advise. Thanks.&lt;BR /&gt;
&lt;BR /&gt;
Tulip.</description>
      <pubDate>Fri, 06 Nov 2009 03:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-achieve-array-function-by-using-SQL/m-p/13016#M1484</guid>
      <dc:creator>tulip</dc:creator>
      <dc:date>2009-11-06T03:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve array function by using SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-achieve-array-function-by-using-SQL/m-p/13017#M1485</link>
      <description>I don't know about better, I came to think of using IN sub-queries:&lt;BR /&gt;
&lt;BR /&gt;
select data2.*&lt;BR /&gt;
from data2&lt;BR /&gt;
where data2.Des1 in(select Destination from data1)&lt;BR /&gt;
or data2.Des2 in(select Destination from data1)&lt;BR /&gt;
or data2.Des3 in(select Destination from data1)&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
If your destination table is not huge, it would be feasable.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Fri, 06 Nov 2009 11:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-achieve-array-function-by-using-SQL/m-p/13017#M1485</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-11-06T11:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve array function by using SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-achieve-array-function-by-using-SQL/m-p/13018#M1486</link>
      <description>Hi, Linus:&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot. It is much better than the way I used before.&lt;BR /&gt;
&lt;BR /&gt;
Nice weekend, Tulip</description>
      <pubDate>Sat, 07 Nov 2009 04:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-achieve-array-function-by-using-SQL/m-p/13018#M1486</guid>
      <dc:creator>tulip</dc:creator>
      <dc:date>2009-11-07T04:10:14Z</dc:date>
    </item>
  </channel>
</rss>

