<?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: Using KEEP with Joins? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661868#M197805</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/24237"&gt;@elwayfan446&lt;/a&gt;&amp;nbsp; Can you post the log please, and particularly the errors that you got for this one-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select *
from table_a
left join table_b (KEEP= id name phone email ) 
on table_b.id = table_a.id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 17 Jun 2020 18:18:50 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-06-17T18:18:50Z</dc:date>
    <item>
      <title>Using KEEP with Joins?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661861#M197802</link>
      <description>&lt;P&gt;Is it possible to use the KEEP= statement with joined datasets?&amp;nbsp; I have tried the following and I am getting errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select *
from table_a
left join table_b (KEEP= id name phone email ) on table_b.id = table_a.id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have also tried to put the join criteria in front of the KEEP= statement...&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select *
from table_a
left join table_b on table_b.id = table_a.id (KEEP= id name phone email ) 
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am getting errors in both of these.&amp;nbsp; Is doing this even possible?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 18:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661861#M197802</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2020-06-17T18:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using KEEP with Joins?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661868#M197805</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/24237"&gt;@elwayfan446&lt;/a&gt;&amp;nbsp; Can you post the log please, and particularly the errors that you got for this one-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select *
from table_a
left join table_b (KEEP= id name phone email ) 
on table_b.id = table_a.id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jun 2020 18:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661868#M197805</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-06-17T18:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using KEEP with Joins?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661878#M197810</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me give you the actual join.&amp;nbsp; My code above was an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select *
from dwacq.msr_acquired_data_key_xref xref 
	left join abdeods.ods_bde_loan l (keep= loan_number first_principal_balance net_payment_due_date first_p_and_i_amount total_escrow_due_amount total_payment_due_amount loan_term remaining_term annual_interest_rate payment_in_full_date lo_type record_status updated_date) on l.loan_number = xref.xref_pnc_loan_number 
	left join abdeods.ods_bde_servicing_fee sf (keep= loan_number investor_loan_number updated_date) on sf.loan_number = xref.xref_pnc_loan_number
	left join abdeods.ods_bde_original_loan ol (keep= loan_number acquisition_date acquisition_or_sale_identifier acquired_principal_balance loan_closing_date first_due_date orig_loan_to_value_ratio loan_purpose_code updated_date) on ol.loan_number = xref.xref_pnc_loan_number
	left join abdeods.ods_bde_user_defined ud (keep= loan_number user_02_position_field_2b user_03_position_field_6a user_04_position_field_9a user_04_position_field_8a user_05_position_field_4b user_10_position_field_6b user_35_position_field_2a user_50_position_field_1a user_04_position_field_5b updated_date) on ud.loan_number = xref.xref_pnc_loan_number
	left join abdeods.ods_bde_property p (keep= loan_number property_alpha_state_code property_zip_code updated_date) on p.loan_number = xref.xref_pnc_loan_number
	left join dwacq.msr_acquired_loanpurpose_desc lpd on lpd.loan_purp_code = ol.loan_purpose_code
	left join dwacq.msr_acquired_lotype_desc lod on lod.lo_type_code = l.lo_type&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the log error I am getting:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="elwayfan446_0-1592419046480.png" style="width: 997px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/45301iA3871ABBD263A4C6/image-dimensions/997x299?v=v2" width="997" height="299" role="button" title="elwayfan446_0-1592419046480.png" alt="elwayfan446_0-1592419046480.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 18:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661878#M197810</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2020-06-17T18:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using KEEP with Joins?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661879#M197811</link>
      <description>&lt;P&gt;This error is clear&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;left join abdeods.ods_bde_loan l (keep= loan_number first_principal_balance net_payment_due_date first_p_and_i_amount total_escrow_due_amount total_payment_due_amount loan_term remaining_term annual_interest_rate payment_in_full_date lo_type record_status updated_date) on l.loan_number = xref.xref_pnc_loan_number &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;left join abdeods.ods_bde_loan (keep= loan_number first_principal_balance net_payment_due_date first_p_and_i_amount total_escrow_due_amount total_payment_due_amount loan_term remaining_term annual_interest_rate payment_in_full_date lo_type record_status updated_date) l  on l.loan_number = xref.xref_pnc_loan_number &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The dataset option (keep=) should precede the alias name &lt;STRONG&gt;l&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 18:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661879#M197811</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-06-17T18:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using KEEP with Joins?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661899#M197818</link>
      <description>&lt;P&gt;If you get in the habit of putting the dataset options touching the dataset name it will be harder for you to insert random text between them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;table_b(KEEP=id name phone email) &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jun 2020 19:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/661899#M197818</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-06-17T19:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using KEEP with Joins?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/663168#M197914</link>
      <description>&lt;P&gt;Thank you for the help. I didn't realize that was the issue.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 13:45:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-KEEP-with-Joins/m-p/663168#M197914</guid>
      <dc:creator>elwayfan446</dc:creator>
      <dc:date>2020-06-18T13:45:15Z</dc:date>
    </item>
  </channel>
</rss>

