<?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: Help with merging databases in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134146#M36414</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try runngin this and view the the qtr1 var in both again. ll get it -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a3;&lt;BR /&gt;&amp;nbsp; set locl.a3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; qtr1=qtr;&lt;BR /&gt;&amp;nbsp; format qtr1 date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data a4;&lt;BR /&gt;&amp;nbsp; set locl.a4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; qtr1=qtr;&lt;BR /&gt;&amp;nbsp; format qtr1 date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QTR var in A3 and A4 actually ve unmatching valurs. you ll ve to change the var in either of the dataset first and then apply merge/join.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 May 2013 20:49:33 GMT</pubDate>
    <dc:creator>sascom10</dc:creator>
    <dc:date>2013-05-14T20:49:33Z</dc:date>
    <item>
      <title>Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134143#M36411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem merging 2 databases (of different length of observations)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code I used;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table a5 as select&lt;/P&gt;&lt;P&gt;A.qtr,&lt;/P&gt;&lt;P&gt;A.mgrno,&lt;/P&gt;&lt;P&gt;A.ticker,&lt;/P&gt;&lt;P&gt;A.D,&lt;/P&gt;&lt;P&gt;B.N,&lt;/P&gt;&lt;P&gt;B.fraction_mean,&lt;/P&gt;&lt;P&gt;B.frmean_1&lt;/P&gt;&lt;P&gt;from a3 as A left join A4 as B on A.qtr=B.qtr and A.ticker=B.ticker&lt;/P&gt;&lt;P&gt;order by qtr, ticker;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However it doesn't work. Even with merge statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a5;merge a3 a4;by qtr ticker;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again it doesn't work. Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 19:52:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134143#M36411</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2013-05-14T19:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134144#M36412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There seem tp be something going on with the format for variable &lt;STRONG&gt;qtr &lt;/STRONG&gt;in both the tables. Try running below step and have a look at qtr1 variable which is not formatted. ll ovbserve the difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname locl 'C:\test';&lt;/P&gt;&lt;P&gt;data a3;&lt;BR /&gt;&amp;nbsp; set locl.a3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; qtr1=qtr;&lt;BR /&gt;&amp;nbsp; *format qtr1 YYQ6.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data a4;&lt;BR /&gt;&amp;nbsp; set locl.a4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; qtr1=qtr;&lt;BR /&gt;&amp;nbsp; *format qtr1 YYQ6.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 20:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134144#M36412</guid>
      <dc:creator>sascom10</dc:creator>
      <dc:date>2013-05-14T20:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134145#M36413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still it doesn't work. As previously, it doesn't fill all the values. The same ticker could appear more than one time in the same quarter. But it will only fill it once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 20:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134145#M36413</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2013-05-14T20:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134146#M36414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try runngin this and view the the qtr1 var in both again. ll get it -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a3;&lt;BR /&gt;&amp;nbsp; set locl.a3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; qtr1=qtr;&lt;BR /&gt;&amp;nbsp; format qtr1 date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data a4;&lt;BR /&gt;&amp;nbsp; set locl.a4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; qtr1=qtr;&lt;BR /&gt;&amp;nbsp; format qtr1 date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QTR var in A3 and A4 actually ve unmatching valurs. you ll ve to change the var in either of the dataset first and then apply merge/join.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 20:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134146#M36414</guid>
      <dc:creator>sascom10</dc:creator>
      <dc:date>2013-05-14T20:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134147#M36415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sascom10 already answered your question, your variable qtr is not equal in the two dataset, therefor it does not merge or join correctly.&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp; In A3 you ahve 1980-4, however the true numeric value for this is 7670. In dataset A4 you have 1980-4, however the TRUe numeric value for it is&amp;nbsp; 7579.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7670 ~= 7579, therefore it will not join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your variable only look like they are the same due to the way you have formatted them (note the format is different in both files).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 20:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134147#M36415</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2013-05-14T20:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134148#M36416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I fix the format (7670 ~= 7579) in order to be the same in both cases?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 21:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134148#M36416</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2013-05-14T21:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134149#M36417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Referencing the 2 steps I mentioned above shift the the date in one of the qtr var such that its matches w qtr of other one.&lt;/P&gt;&lt;P&gt;That is one of the ways I look at it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 21:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134149#M36417</guid>
      <dc:creator>sascom10</dc:creator>
      <dc:date>2013-05-14T21:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134150#M36418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But even if I change the format, will the numeric values remain different?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 21:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134150#M36418</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2013-05-14T21:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134151#M36419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's right.&amp;nbsp; Changing format will not affect the underlying values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add 91 to the smaller value.&amp;nbsp; Then the dates will be equivalent. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears that both values are sas dates, with one using first day of quarter and the earlier the last day of quarter.&amp;nbsp; 7579 ==&amp;gt; 10/1/2010&amp;nbsp;&amp;nbsp; 7670 ==&amp;gt;10/31/2010 &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 22:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134151#M36419</guid>
      <dc:creator>LarryWorley</dc:creator>
      <dc:date>2013-05-14T22:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134152#M36420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Larry.&lt;/P&gt;&lt;P&gt;The problem is that not all quarters have 91 days difference. So it doesn't fix the problem entirely.&lt;/P&gt;&lt;P&gt;Is there anyway to convert the dates of the one database to the last day of quarter?&lt;/P&gt;&lt;P&gt;For example using &lt;STRONG&gt;intnx&lt;/STRONG&gt; (though I don't know how).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 22:48:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134152#M36420</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2013-05-14T22:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134153#M36421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming QTR is a date actually ( I haven't looked at your data) you can convert them in the join condition, but you should also change it in your select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sql;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;create table a5 as select&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;put(A.qtr, yy6.) as QTR,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;A.mgrno,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;A.ticker,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;A.D,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;B.N,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;B.fraction_mean,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;B.frmean_1&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;from a3 as A left join A4 as B on put(A.qtr, yyq6.)=put(B.qtr, yyq6.) and A.ticker=B.ticker&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;order by qtr, ticker;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 23:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134153#M36421</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-05-14T23:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with merging databases</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134154#M36422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks Reeza, it worked!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 09:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-merging-databases/m-p/134154#M36422</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2013-05-15T09:32:55Z</dc:date>
    </item>
  </channel>
</rss>

