<?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 Use Left Join where clause in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Use-Left-Join-where-clause/m-p/468972#M5707</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table master_table as select a.*, b.*
  from dataseta a left join datasetb b
  on a.permno = b.permno
  where intnx('month',a.date,12,'E')&amp;gt;= b.date
  group by a.permno, a.date;
  quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;My dataset b contains r_size, size_min, size_max, permno date. This dataset has rows of observation for the month of June. The dataset a dates that ranges for all month. I want to merge the dataset b with dataset a matching permno of both dataset and giving the same row from dataset b to every month of year in dataset a that follows the month of June in dataset b .&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, as an end output, for permno 92719, r_size should be 0, size_min should be 0 etc. for 31DEC1990 in the merged dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dataset a" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21124iF72113BD46810F6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="size decile.PNG" alt="Dataset a" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Dataset a&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="b" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21125i57A7287576E0928B/image-size/large?v=v2&amp;amp;px=999" role="button" title="size decile2.PNG" alt="b" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;b&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Jun 2018 03:38:23 GMT</pubDate>
    <dc:creator>fafrin420</dc:creator>
    <dc:date>2018-06-10T03:38:23Z</dc:date>
    <item>
      <title>Use Left Join where clause</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Use-Left-Join-where-clause/m-p/468972#M5707</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table master_table as select a.*, b.*
  from dataseta a left join datasetb b
  on a.permno = b.permno
  where intnx('month',a.date,12,'E')&amp;gt;= b.date
  group by a.permno, a.date;
  quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;My dataset b contains r_size, size_min, size_max, permno date. This dataset has rows of observation for the month of June. The dataset a dates that ranges for all month. I want to merge the dataset b with dataset a matching permno of both dataset and giving the same row from dataset b to every month of year in dataset a that follows the month of June in dataset b .&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, as an end output, for permno 92719, r_size should be 0, size_min should be 0 etc. for 31DEC1990 in the merged dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dataset a" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21124iF72113BD46810F6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="size decile.PNG" alt="Dataset a" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Dataset a&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="b" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21125i57A7287576E0928B/image-size/large?v=v2&amp;amp;px=999" role="button" title="size decile2.PNG" alt="b" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;b&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2018 03:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Use-Left-Join-where-clause/m-p/468972#M5707</guid>
      <dc:creator>fafrin420</dc:creator>
      <dc:date>2018-06-10T03:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Use Left Join where clause</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Use-Left-Join-where-clause/m-p/468981#M5708</link>
      <description>&lt;P&gt;I guess you may need to do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table master_table as 
select 
    a.*, 
    b.r_size, 
    b.size_min, 
    b.size_max,
    b.date as date_b
from 
    dataseta a left join 
    datasetb b 
        on  a.permno=b.permno and 
            year(a.date) = year(b.date);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Jun 2018 05:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Use-Left-Join-where-clause/m-p/468981#M5708</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-06-10T05:45:12Z</dc:date>
    </item>
  </channel>
</rss>

