<?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: Conditionally Merge DSs rows? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525235#M142898</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, you are absolutely right. I read the question too fast it seems &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2019 21:43:09 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-01-07T21:43:09Z</dc:date>
    <item>
      <title>Conditionally Merge DSs rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525212#M142892</link>
      <description>&lt;P&gt;Hi. I have the following 5 datasets. Each has a variable named review_ind, which can be either 1 or 0.&amp;nbsp; Can I merge the datasets together, but only keep the rows if review_ind=1 in at least one of the datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy/efficient way to do this during the merge or will I need to individually subset each of the 5 datasets&amp;nbsp;(where review_ind=1) before I merge?&amp;nbsp; I'm trying to reduce the overall lines of code in this program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA ALL_CLAIMS;&lt;BR /&gt;MERGE&lt;BR /&gt;&amp;amp;USERN._LIB.F3_DISTANCE_CAR_F&lt;BR /&gt;&amp;amp;USERN._LIB.F4_RFRG_NVR_BLG_CAR_F&lt;BR /&gt;&amp;amp;USERN._LIB.F5_BENE_NO_HIST_CAR_F&lt;BR /&gt;&amp;amp;USERN._LIB.F6_BENE_SHARE_CAR_F;&lt;BR /&gt;BY ID_NUM BENE_SK;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 20:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525212#M142892</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-01-07T20:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally Merge DSs rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525213#M142893</link>
      <description>&lt;P&gt;You could rename REVIEW_IND so that it has a different name in each data set (e.g. REVIEW_IND1 through REVIEW_IND5), then if the maximum of all of these new variables is 1, keep the record, otherwise don't keep it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all_claims;
    merge
        &amp;amp;usern._lib.f3_distance_car_f(rename=(review_ind=review_ind1))
        &amp;amp;usern._lib.f4_rfrg_nvr_blg_car_f(rename=(review_ind=review_ind2))
        &amp;amp;usern._lib.f5_bene_no_hist_car_f(rename=(review_ind=review_ind3))
        &amp;amp;usern._lib.f6_bene_share_car_f(rename=(review_ind=review_ind4));
    by id_num bene_sk;
    if max(of review_ind:)=0 then delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Jan 2019 20:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525213#M142893</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-07T20:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally Merge DSs rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525214#M142894</link>
      <description>&lt;P&gt;I only see 4 data sets? However, you can do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all_claims;
merge
&amp;amp;usern._lib.f3_distance_car_f(where=(review_ind=1))
&amp;amp;usern._lib.f4_rfrg_nvr_blg_car_f(where=(review_ind=1))
&amp;amp;usern._lib.f5_bene_no_hist_car_f(where=(review_ind=1))
&amp;amp;usern._lib.f6_bene_share_car_f(where=(review_ind=1));
by id_num bene_sk;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Jan 2019 20:36:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525214#M142894</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-07T20:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally Merge DSs rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525216#M142895</link>
      <description>&lt;P&gt;Señor&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since neither you nor I really know the contents of these data sets, nor do we really know what else should be in the output data set, I simply mention the possibility that there may be variables with non-missing values in each of these data sets that would not get merged into the final result using your code, but those variables would be present given my code.&amp;nbsp;Or maybe&amp;nbsp;your code is the right thing to do. The explanation given is silent on this issue.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 20:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525216#M142895</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-07T20:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally Merge DSs rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525217#M142896</link>
      <description>Thanks so much for taking the time to help!</description>
      <pubDate>Mon, 07 Jan 2019 20:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525217#M142896</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-01-07T20:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally Merge DSs rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525235#M142898</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, you are absolutely right. I read the question too fast it seems &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 21:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-Merge-DSs-rows/m-p/525235#M142898</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-07T21:43:09Z</dc:date>
    </item>
  </channel>
</rss>

