<?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: proc left join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402158#M97635</link>
    <description>&lt;P&gt;OK, the log for proc step&amp;nbsp; is&amp;nbsp;&lt;/P&gt;&lt;P&gt;11&lt;BR /&gt;12 proc sql;&lt;BR /&gt;13 create table h2&lt;BR /&gt;14 as select pro8.*,trd_year4.Yopnprc as lagYopnprc&lt;BR /&gt;15 from w1.pro8 left join w1.trd_year4&lt;BR /&gt;16 on pro8.stkcd=trd_year4.stkcd and pro8.year=trd_year4.year1;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NOTE: the&amp;nbsp; WORK.H2 has been created ´there are 35596 rows 6 columns.&lt;/P&gt;&lt;P&gt;i drop the processing time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
    <pubDate>Sun, 08 Oct 2017 06:45:00 GMT</pubDate>
    <dc:creator>JNWong</dc:creator>
    <dc:date>2017-10-08T06:45:00Z</dc:date>
    <item>
      <title>proc left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402148#M97626</link>
      <description>&lt;P&gt;Hi，&lt;/P&gt;&lt;P&gt;AS&amp;nbsp;i need to calculated the opening price-deflated earnings which is (net profits t /price&amp;nbsp;t-1) within groups.&lt;/P&gt;&lt;P&gt;the price would be the value of previous year. the net profit is current value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;the data in my profit table(containing net profit) is like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;stkcd&amp;nbsp; &amp;nbsp; year&amp;nbsp; &amp;nbsp; &amp;nbsp;net profit&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1991&amp;nbsp; &amp;nbsp; 4000&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1992&amp;nbsp; &amp;nbsp; 4500&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1993&amp;nbsp; &amp;nbsp; 3800&lt;/P&gt;&lt;P&gt;&amp;nbsp;00002&amp;nbsp; &amp;nbsp;1991&amp;nbsp; &amp;nbsp; 2000&lt;/P&gt;&lt;P&gt;&amp;nbsp;00002&amp;nbsp; &amp;nbsp;1992&amp;nbsp; &amp;nbsp; 3000&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the data in the market table (containing the opening price) is like&lt;/P&gt;&lt;P&gt;&amp;nbsp;stkcd&amp;nbsp; &amp;nbsp; year&amp;nbsp; &amp;nbsp; &amp;nbsp;price&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1991&amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1992&amp;nbsp; &amp;nbsp; 25&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1993&amp;nbsp; &amp;nbsp; 30&lt;/P&gt;&lt;P&gt;&amp;nbsp;00002&amp;nbsp; &amp;nbsp;1991&amp;nbsp; &amp;nbsp; 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;00002&amp;nbsp; &amp;nbsp;1992&amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want the get the result like :&lt;/P&gt;&lt;P&gt;stkcd&amp;nbsp; &amp;nbsp; year&amp;nbsp; &amp;nbsp; &amp;nbsp;net profit&amp;nbsp; price&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1991&amp;nbsp; &amp;nbsp; 4000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1992&amp;nbsp; &amp;nbsp; 4500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;00001&amp;nbsp; &amp;nbsp;1993&amp;nbsp; &amp;nbsp; 3800&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&lt;/P&gt;&lt;P&gt;&amp;nbsp;00002&amp;nbsp; &amp;nbsp;1991&amp;nbsp; &amp;nbsp; 2000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;&amp;nbsp;00002&amp;nbsp; &amp;nbsp;1992&amp;nbsp; &amp;nbsp; 3000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have add a variable (year1 )&amp;nbsp; which is equal to year+1 to the market table so that i can identify the deflated price value.&lt;/P&gt;&lt;P&gt;and try the code like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table h2 as&lt;BR /&gt;select profit.*,market.price as lagprice&lt;BR /&gt;from profit&amp;nbsp; left join market&lt;BR /&gt;on profit.stkcd=market.stkcd and profit.year=market.year1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it have processed without error but in the last table, the price values are all missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope you can help me with the problem! thank!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jane&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 05:42:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402148#M97626</guid>
      <dc:creator>JNWong</dc:creator>
      <dc:date>2017-10-08T05:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402151#M97629</link>
      <description>&lt;P&gt;How did you add year1, and what does the log of both steps look like (use the {i} icon for posting logs)?&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 05:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402151#M97629</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-08T05:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: proc left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402152#M97630</link>
      <description>&lt;P&gt;Sorry for clicking the wrong button.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i just add the year1 using the data step:&amp;nbsp;&lt;/P&gt;&lt;P&gt;data market;&lt;BR /&gt;set market;&lt;BR /&gt;year1= year +1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the pro log is :&amp;nbsp;&lt;/P&gt;&lt;P&gt;35 proc sql;&lt;BR /&gt;36 create table h2&lt;BR /&gt;37 as select pro9.*,trd_year5.Yopnprc as lagYopnprc&lt;BR /&gt;38 from w1.pro9 left join w1.trd_year5&lt;BR /&gt;39 on pro9.stkcd=trd_year5.stkcd and pro9.year=trd_year5.year1;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NOTE:&amp;nbsp; WORK.H2&amp;nbsp; has been created，there are 35376 rows，66 colmuns。&lt;/P&gt;&lt;P&gt;40 quit;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 06:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402152#M97630</guid>
      <dc:creator>JNWong</dc:creator>
      <dc:date>2017-10-08T06:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402154#M97632</link>
      <description>&lt;P&gt;There's no access to market in your proc sql. Without seeing&amp;nbsp;&lt;U&gt;all&lt;/U&gt; the code, there's no way to diagnose it.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 06:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402154#M97632</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-08T06:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: proc left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402155#M97633</link>
      <description>&lt;P&gt;And&amp;nbsp;&lt;U&gt;follow my advice for posting logs&lt;/U&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 06:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402155#M97633</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-08T06:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: proc left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402158#M97635</link>
      <description>&lt;P&gt;OK, the log for proc step&amp;nbsp; is&amp;nbsp;&lt;/P&gt;&lt;P&gt;11&lt;BR /&gt;12 proc sql;&lt;BR /&gt;13 create table h2&lt;BR /&gt;14 as select pro8.*,trd_year4.Yopnprc as lagYopnprc&lt;BR /&gt;15 from w1.pro8 left join w1.trd_year4&lt;BR /&gt;16 on pro8.stkcd=trd_year4.stkcd and pro8.year=trd_year4.year1;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NOTE: the&amp;nbsp; WORK.H2 has been created ´there are 35596 rows 6 columns.&lt;/P&gt;&lt;P&gt;i drop the processing time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 06:45:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402158#M97635</guid>
      <dc:creator>JNWong</dc:creator>
      <dc:date>2017-10-08T06:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: proc left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402160#M97636</link>
      <description>&lt;P&gt;This is getting nowhere.&lt;/P&gt;
&lt;P&gt;Post examples for your datasets pro8 and trd_year4.&lt;/P&gt;
&lt;P&gt;Use datasteps with datalines, so we can easily recreate your datasets with copy/pasting and submit.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 07:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402160#M97636</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-08T07:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: proc left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402179#M97642</link>
      <description>&lt;P&gt;Thanks, KurtBremser&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;i think it may be something wrong with my datasets. and i converted the character values for 'stkcd' to numeric values and it worked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;i would care of the way in which i post my question in future.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Jane&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 11:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-left-join/m-p/402179#M97642</guid>
      <dc:creator>JNWong</dc:creator>
      <dc:date>2017-10-08T11:44:09Z</dc:date>
    </item>
  </channel>
</rss>

