<?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 SQL Merging error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544946#M150718</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261982"&gt;@Pabster&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that&amp;nbsp;DLDTE is a year and not a date value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2019 16:47:53 GMT</pubDate>
    <dc:creator>ErikLund_Jensen</dc:creator>
    <dc:date>2019-03-21T16:47:53Z</dc:date>
    <item>
      <title>PROC SQL Merging error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544916#M150707</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table AltmanV3.Donnee_Avant_F as
select distinct b.*,ID
from AltmanV3.Last_Avail_Bnkrpt as a, AltmanV3.Inactive as b
where b.gvkey=a.gvkey and (b.fyear = (a.Fyear-5)  and (b.fyear &amp;lt;= a.Fyear));
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it works perfectly. The purpose of it is to give me all the matching companies that are bankrupt at a given year (a.Fyear- x (x can be any number)).&lt;BR /&gt;Here is the result:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;625
626  /* OPTION 1 AVEC FYEAR*/
627  proc sql;
628  create table AltmanV3.Donnee_Avant_F as
629  select distinct b.*,ID
630  from AltmanV3.Last_Avail_Bnkrpt as a, AltmanV3.Inactive as b
631  where b.gvkey=a.gvkey and ((b.fyear = (a.fyear-5) ) and (b.fyear &amp;lt;= a.fyear));
NOTE: Table ALTMANV3.DONNEE_AVANT_F created, with 1128 rows and 18 columns.

632  quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;But when I do it like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table AltmanV3.Donnee_Avant_F as
select distinct b.*,ID
from AltmanV3.Last_Avail_Bnkrpt as a, AltmanV3.Inactive as b
where b.gvkey=a.gvkey and (b.fyear = (a.DLDTE-5)  and (b.fyear &amp;lt;= a.DLDTE));
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it just doesn`t properly. here is the log screen:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;320  proc sql;
321  create table AltmanV3.Donnee_Avant_F as
322  select distinct b.*,ID
323  from AltmanV3.Last_Avail_Bnkrpt as a, AltmanV3.Inactive as b
324  where b.gvkey=a.gvkey and (b.fyear = (a.DLDTE-5)  and (b.fyear &amp;lt;= a.DLDTE));
NOTE: Table ALTMANV3.DONNEE_AVANT_F created, with 0 rows and 18 columns.

325  quit;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This way I am using the companies deletion year from the system to compare.&amp;nbsp;&lt;BR /&gt;Both DLDTE and FYEAR are in&amp;nbsp;&lt;STRONG&gt;Year.&amp;nbsp;&lt;/STRONG&gt;format so I dont understand why or how can I make it work&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 16:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544916#M150707</guid>
      <dc:creator>Pabster</dc:creator>
      <dc:date>2019-03-21T16:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Merging error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544946#M150718</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261982"&gt;@Pabster&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that&amp;nbsp;DLDTE is a year and not a date value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 16:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544946#M150718</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-03-21T16:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Merging error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544948#M150719</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12887"&gt;@ErikLund_Jensen&lt;/a&gt;&amp;nbsp;. I just check and it is actually a date value.&lt;BR /&gt;&lt;BR /&gt;But since I put in in the year. format,shouldn't that do the trick? or how would it be possible?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 16:52:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544948#M150719</guid>
      <dc:creator>Pabster</dc:creator>
      <dc:date>2019-03-21T16:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Merging error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544952#M150720</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261982"&gt;@Pabster&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume that your data are SAS tables, and in SAS a date value is the number of days since 01jan1960. You can put it with a format and assign these formats to the variable in the data set also, but the format does not change the value, only the way it is displayed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the SAS year-function to change the value "on the fly" in your comparison, like&amp;nbsp; xx &amp;lt;= year(DLDTE). This makes the comparison operator to work against the extracted year and not the date value. You could also prepare data by adding an extra variable with the year value using the same function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 17:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544952#M150720</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-03-21T17:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Merging error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544958#M150721</link>
      <description>&lt;P&gt;SQL joins (and data step merges) work with raw values, not the formatted ones. Use the year() function to extract the year.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 17:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544958#M150721</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-21T17:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Merging error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544961#M150723</link>
      <description>- as I told you earlier</description>
      <pubDate>Thu, 21 Mar 2019 17:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Merging-error/m-p/544961#M150723</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-03-21T17:44:17Z</dc:date>
    </item>
  </channel>
</rss>

