<?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: Merging Data in Proc SQL in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507833#M1526</link>
    <description>&lt;P&gt;I think that would still not stop proc sql to&amp;nbsp; remerge .&lt;SPAN&gt;'-) Let's wait and see&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/48113"&gt;@titanbob&lt;/a&gt;&amp;nbsp; Hi, Try running your code with following change in group by&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;group by date, asset_agreement, product,&amp;nbsp;new_asset_execution_type,&amp;nbsp;affiliate, o_n_term, maturity_bucket ;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Oct 2018 17:21:04 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-10-26T17:21:04Z</dc:date>
    <item>
      <title>Merging Data in Proc SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507812#M1521</link>
      <description>&lt;P&gt;Getting a Note:&amp;nbsp;NOTE: The query requires remerging summary statistics back with the original data.&amp;nbsp; Not sure what the issue is with my program why it is not grouping the data correctly. Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table trade_class_5_nc_borrow as&lt;BR /&gt;select&lt;BR /&gt;date,&lt;BR /&gt;asset_agreement,&lt;BR /&gt;product,&lt;BR /&gt;case when (sourcesystemname = 'Loanet_0250' or inventory = 'T') and product = 'UST' then 'Funding' else 'Non-Cash Borrow' end as new_asset_execution_type,&lt;BR /&gt;affiliate,&lt;BR /&gt;o_n_term,&lt;BR /&gt;maturity_bucket,&lt;BR /&gt;sum(allocated_funding_value) as sum_allocated_funding_value&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;from class_trade_2&lt;/P&gt;&lt;P&gt;where agreement_type = 'Non-Cash Borrow'&lt;BR /&gt;group by date, asset_agreement, product, case when (sourcesystemname = 'Loanet_0250' or inventory = 'T') and product = 'UST' then 'Funding' else 'Non-Cash Borrow' end, affiliate, o_n_term, maturity_bucket ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 16:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507812#M1521</guid>
      <dc:creator>titanbob</dc:creator>
      <dc:date>2018-10-26T16:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data in Proc SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507828#M1524</link>
      <description>&lt;P&gt;try using&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;calculated new_asset_execution_type&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in your group instead of case when&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this. this case when thing works in every other sql implementation, I have used but somehow not in proc sql&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table cars as 
select case when make = 'Acura' then 'Audi'
else make end as newmake, model, sum(msrp) from sashelp.cars
group by calculated newmake , model
;

proc sql;
create table cars as 
select case when make = 'Acura' then 'Audi'
else make end as newmake, model, sum(msrp) from sashelp.cars
group by case when make = 'Acura' then 'Audi'
else make end , model
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Oct 2018 17:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507828#M1524</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-10-26T17:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data in Proc SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507833#M1526</link>
      <description>&lt;P&gt;I think that would still not stop proc sql to&amp;nbsp; remerge .&lt;SPAN&gt;'-) Let's wait and see&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/48113"&gt;@titanbob&lt;/a&gt;&amp;nbsp; Hi, Try running your code with following change in group by&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;group by date, asset_agreement, product,&amp;nbsp;new_asset_execution_type,&amp;nbsp;affiliate, o_n_term, maturity_bucket ;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 17:21:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507833#M1526</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-26T17:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data in Proc SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507845#M1528</link>
      <description>&lt;P&gt;To decide whether or not to remerge, SAS doesn't go as far as comparing complex expressions between the select columns and the group by columns. This is reasonable behavior because otherwise SAS/SQL would have to check the logical or mathematical equivalence of expressions, a task with no end.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 17:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507845#M1528</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-10-26T17:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data in Proc SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507856#M1530</link>
      <description>&lt;P&gt;A clearer demo using sashelp.class&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Log report comparisions:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;WANT1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;5352 proc sql;&lt;BR /&gt;5353 create table want1 as&lt;BR /&gt;5354 select sex,case when (age&amp;lt;=12) then (age&amp;lt;=12)*1 else 0 end as a, sum(age) as s&lt;BR /&gt;5355 from sashelp.class&lt;BR /&gt;5356 group by sex,case when (age&amp;lt;=12) then (age&amp;lt;=12)*1 else 0 end;&lt;BR /&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;BR /&gt;NOTE: Table WORK.WANT1 created, with 19 rows and 3 columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;WANT2&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;5358 proc sql;&lt;BR /&gt;5359 create table want2 as&lt;BR /&gt;5360 select sex,case when (age&amp;lt;=12) then (age&amp;lt;=12)*1 else 0 end as a, sum(age) as s&lt;BR /&gt;5361 from sashelp.class&lt;BR /&gt;5362 group by sex,a;&lt;BR /&gt;NOTE: Table WORK.WANT2 created, with 4 rows and 3 columns.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 18:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507856#M1530</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-26T18:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data in Proc SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507875#M1533</link>
      <description>&lt;P&gt;Thanks, that worked !&amp;nbsp; Appreciate the help!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 19:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Data-in-Proc-SQL/m-p/507875#M1533</guid>
      <dc:creator>titanbob</dc:creator>
      <dc:date>2018-10-26T19:35:02Z</dc:date>
    </item>
  </channel>
</rss>

