<?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: Combination condition from 2 files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330340#M74080</link>
    <description>&lt;P&gt;I just update my post with the complete final "want" file to make it clear.&lt;/P&gt;
&lt;P&gt;Could you please check it again to see if you can help with that problem?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
    <pubDate>Mon, 06 Feb 2017 22:17:46 GMT</pubDate>
    <dc:creator>hhchenfx</dc:creator>
    <dc:date>2017-02-06T22:17:46Z</dc:date>
    <item>
      <title>Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330226#M74018</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;
&lt;P&gt;I have 2 files, one file contains condition on variable "white", one contains condition for variable "black".&lt;/P&gt;
&lt;P&gt;The following SQL code and create all combinations for white and black conditions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to have the code that allow me to specify number of White combine with number of Black.&lt;/P&gt;
&lt;P&gt;For example: 2 condition White (W) and 2 condition black(B). so the output file look like:&lt;/P&gt;
&lt;P&gt;w1_name &amp;nbsp;w1_value &amp;nbsp;w2_name &amp;nbsp;w2_value &amp;nbsp; &amp;nbsp; b1_name &amp;nbsp;b1_value &amp;nbsp;&lt;SPAN&gt;b2_name &amp;nbsp;b2_value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output for 2black and 2 white should be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="632"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;&lt;FONT color="#FF0000"&gt;B1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;B2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;5&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;W1&lt;/TD&gt;
&lt;TD width="75"&gt;2&lt;/TD&gt;
&lt;TD width="75"&gt;W2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;&lt;FONT color="#FF0000"&gt;B1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;B2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;5&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;W1&lt;/TD&gt;
&lt;TD width="75"&gt;2&lt;/TD&gt;
&lt;TD width="75"&gt;W2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;&lt;FONT color="#FF0000"&gt;B2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;5&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;B3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;&lt;FONT color="#FF0000"&gt;5&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="75"&gt;W1&lt;/TD&gt;
&lt;TD width="75"&gt;2&lt;/TD&gt;
&lt;TD width="75"&gt;W2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;B1&lt;/TD&gt;
&lt;TD width="75"&gt;1&lt;/TD&gt;
&lt;TD width="75"&gt;B2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W1&lt;/TD&gt;
&lt;TD width="75"&gt;2&lt;/TD&gt;
&lt;TD width="75"&gt;W3&lt;/TD&gt;
&lt;TD width="75"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;B1&lt;/TD&gt;
&lt;TD width="75"&gt;1&lt;/TD&gt;
&lt;TD width="75"&gt;B2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W1&lt;/TD&gt;
&lt;TD width="75"&gt;2&lt;/TD&gt;
&lt;TD width="75"&gt;W3&lt;/TD&gt;
&lt;TD width="75"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;B2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;B3&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W1&lt;/TD&gt;
&lt;TD width="75"&gt;2&lt;/TD&gt;
&lt;TD width="75"&gt;W3&lt;/TD&gt;
&lt;TD width="75"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;B1&lt;/TD&gt;
&lt;TD width="75"&gt;1&lt;/TD&gt;
&lt;TD width="75"&gt;B2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W3&lt;/TD&gt;
&lt;TD width="75"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;B1&lt;/TD&gt;
&lt;TD width="75"&gt;1&lt;/TD&gt;
&lt;TD width="75"&gt;B2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W3&lt;/TD&gt;
&lt;TD width="75"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;B2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;B3&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W2&lt;/TD&gt;
&lt;TD width="75"&gt;5&lt;/TD&gt;
&lt;TD width="75"&gt;W3&lt;/TD&gt;
&lt;TD width="75"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess it could be done through some sort of DO LOOP but I dont know how to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could anyone help me with that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for your time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data black;
input black_name $ black_value;
datalines;
b1 1
b2 5
b3 5
; run;

data white;
input white_name $ white_value;
datalines;
w1 2
w2 5
w3 7
;run;

*1 black with 1 white;
data black; set black;
d=1;run;

data white; set white;
d=1;run;

proc sql;
create table want1_1 as select * from black as a full join white as b
on a.d=b.d;quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 22:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330226#M74018</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-06T22:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330233#M74020</link>
      <description>&lt;P&gt;It looks like you are either looking to combine data and then transpose or transpose and then combine from your desired output description.&lt;/P&gt;
&lt;P&gt;Could you post the exact values for the desired output given your example data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since d=1 for ALL records in both sets the role it plays is not obvious.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 16:19:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330233#M74020</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-06T16:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330235#M74021</link>
      <description>&lt;P&gt;As it stands now, your program gives you all combinations of the observations.&amp;nbsp; You could have gotten it simply, without creating the variable &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table want as select * from black, white;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you describe what you want, it's not clear if you are trying to use the same sets of variables, but with a subset of the combinations.&amp;nbsp; If that is the case, you are permitted to specify options on the data sets such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table want as select * from black (obs=2), white (firstobs=3);&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Those may be the tools you are looking for.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 16:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330235#M74021</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-06T16:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330244#M74024</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not very clear for me what are the expected results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to pick the first n, m rows of each datasets and arrange them in a single row, this macro might work for you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%macro doit(IN_W,IN_B,B,W,OUT);
data &amp;amp;OUT;
     drop WHITE_: BLACK_:;
     set WHITE end=_EOFW; * pick from white;
     %do I=1 %to &amp;amp;W;
     if _N_ eq &amp;amp;I then do;
     retain W&amp;amp;I._NAME W&amp;amp;I._VALUE;
     W&amp;amp;I._NAME=WHITE_NAME;
     W&amp;amp;I._VALUE=WHITE_VALUE;
     end;
     %end;
     set BLACK end=_EOFB; * pick from black;
     %do J=1 %to &amp;amp;B;
     if _N_ eq &amp;amp;J then do;
     retain B&amp;amp;J._NAME B&amp;amp;J._VALUE;
     B&amp;amp;J._NAME=BLACK_NAME;
     B&amp;amp;J._VALUE=BLACK_VALUE;
     end;
     %end;
     if _EOFW and _EOFB then output; * check if last row;
run;
%mend doit;

%doit(WHITE,BLACK,2,2,WANT); * in_white, in_black, white, black, out;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 17:06:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330244#M74024</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-02-06T17:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330340#M74080</link>
      <description>&lt;P&gt;I just update my post with the complete final "want" file to make it clear.&lt;/P&gt;
&lt;P&gt;Could you please check it again to see if you can help with that problem?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 22:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330340#M74080</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-06T22:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330434#M74129</link>
      <description>&lt;P&gt;OK.&lt;BR /&gt; &lt;BR /&gt;I've modified the macro to get you what you want, as long as you don't mind a different order:&lt;BR /&gt; &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro doit(IN_W,IN_B,B,W,OUT);
proc sql noprint;
create table &amp;amp;OUT (drop = _:) as
     select distinct *
     from 
     %do I=1 %to &amp;amp;B;
     &amp;amp;IN_B (keep=BLACK_NAME BLACK_VALUE
            rename=(BLACK_NAME=B&amp;amp;I._NAME BLACK_VALUE=B&amp;amp;I._VALUE)) as B&amp;amp;I,%end;
     %do J=1 %to &amp;amp;W;
     &amp;amp;IN_W (keep=WHITE_NAME WHITE_VALUE
            rename=(WHITE_NAME=W&amp;amp;J._NAME WHITE_VALUE=W&amp;amp;J._VALUE)) as W&amp;amp;J,%end;
     &amp;amp;IN_W (obs=1 keep=WHITE_NAME rename=(WHITE_NAME=_DUMMY)) as _DUMMY
     where %do I=1 %to %eval(&amp;amp;B-1); B&amp;amp;I._NAME lt B%eval(&amp;amp;I+1)_NAME and %end;
           %do J=1 %to %eval(&amp;amp;W-1); W&amp;amp;J._NAME lt W%eval(&amp;amp;J+1)_NAME and %end;
     1;
quit;
%mend doit;&lt;BR /&gt;
%doit(WHITE,BLACK,2,2,WANT); * in_white, in_black, white, black, out;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;The cartesian product will produce the permutations following the rules (where condition) of the results you need.&lt;BR /&gt; &lt;BR /&gt;For example for B=2, W=2 the macro will build the following SQL statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select distinct * from
       BLACK (keep=BLACK_NAME BLACK_VALUE
              rename=(BLACK_NAME=B1_NAME BLACK_VALUE=B1_VALUE)) as B1,
       BLACK (keep=BLACK_NAME BLACK_VALUE
              rename=(BLACK_NAME=B2_NAME BLACK_VALUE=B2_VALUE)) as B2,
       WHITE (keep=WHITE_NAME WHITE_VALUE
              rename=(WHITE_NAME=W1_NAME WHITE_VALUE=W1_VALUE)) as W1,
       WHITE (keep=WHITE_NAME WHITE_VALUE
              rename=(WHITE_NAME=W2_NAME WHITE_VALUE=W2_VALUE)) as W2
&lt;BR /&gt;       where B1_NAME lt B2_NAME and W1_NAME lt W2_NAME&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Hope it helps.&lt;BR /&gt; &lt;BR /&gt;Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 10:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330434#M74129</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-02-07T10:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330501#M74159</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I just update my post with the complete final "want" file to make it clear.&lt;/P&gt;
&lt;P&gt;Could you please check it again to see if you can help with that problem?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You Still have not described the role of your D variable.&lt;/P&gt;
&lt;P&gt;This does sort of a two by two case but this will not expand easily to a generic number and I am not sure whether your "want" has been reduced from all combinations or if there is some as yet undefined rule to get that specific result.&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table blackPaired as
   select a.*, b.black_name as black_name2, b.black_value as black_value2
   from black as a, black as b;
   create table whitePaired as
   select a.*, b.white_name as white_name2, b.white_value as white_value2
   from white as a, white as b;
quit;

data want;
   merge blackpaired whitepaired;
run;
/* or */
proc sql;
  create table want2 as
  select blackpaired.*,whitepaired.*
  from blackpaired, whitepaired;
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Feb 2017 15:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330501#M74159</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-07T15:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330505#M74162</link>
      <description>&lt;P&gt;The d=1. I am sorry for my coding skill. I created it only to serve the purpose of merging in the proc sql in the section "on a.d=b.d".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 16:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330505#M74162</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-07T16:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330517#M74169</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The d=1. I am sorry for my coding skill. I created it only to serve the purpose of merging in the proc sql in the section "on a.d=b.d".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When the variable d has the same value for all records in both sets then&amp;nbsp;a simple join on&amp;nbsp;has the same behavior as a cartesian join which can be accomplished with the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From dataset1, dataset2&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 16:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/330517#M74169</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-07T16:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/331232#M74413</link>
      <description>&lt;P&gt;Hi DanielSantos,&lt;/P&gt;
&lt;P&gt;This code is great but complicate.&lt;/P&gt;
&lt;P&gt;I can see that for a 2black 2white, the code creates 4 seperate file B1 B2 W1 W2 (from the 2 loop)&lt;/P&gt;
&lt;P&gt;1 more file WHITE is created as dummy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How you merge them in the last 3 row is really magical to me. Especially the "1" at the end.&lt;/P&gt;
&lt;P&gt;Can you ellaborate the code a bit?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;     where %do I=1 %to %eval(&amp;amp;B-1); B&amp;amp;I._NAME lt B%eval(&amp;amp;I+1)_NAME and %end;
           %do J=1 %to %eval(&amp;amp;W-1); W&amp;amp;J._NAME lt W%eval(&amp;amp;J+1)_NAME and %end;
     1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Feb 2017 16:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/331232#M74413</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-09T16:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Combination condition from 2 files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/331239#M74415</link>
      <description>&lt;P&gt;Hi Ballardw,&lt;/P&gt;
&lt;P&gt;The code produce some undesirable combination within blackpair table and whitepair table.&lt;/P&gt;
&lt;P&gt;For example, blackpair table has (b1 b1) , [(b1,b2) and (b2,b1)].&lt;/P&gt;
&lt;P&gt;I think if we can eliminate these duplicate, the merge later step will do the work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I try this code below but it only help to eliminate the (b1,b1) type of combination. I cant eliminate the other combination&amp;nbsp;&lt;SPAN&gt; [(b1,b2) and (b2,b1)]&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table blackPaired as
   select distinct a.*, b.black_name as b2_name, b.black_value as b2_value
   from black as a left join black as b on a.black_name	^=	b.black_name;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 17:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-condition-from-2-files/m-p/331239#M74415</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-09T17:00:52Z</dc:date>
    </item>
  </channel>
</rss>

