<?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 Case WHEN....how to? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439744#M69149</link>
    <description>You'll need a case for each var assignment, hence repeating of some logic - one little drawback for SQL over the data step.</description>
    <pubDate>Fri, 23 Feb 2018 16:02:40 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2018-02-23T16:02:40Z</dc:date>
    <item>
      <title>PROC SQL Case WHEN....how to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/438970#M69115</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edited...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I in a Proc SQL statement maintain this datastep: Also, I want to obtain a cartesian product so there is a deviation form datastep but it will be controlled by a where clause in the Proc SQl Code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;merge dset_1 dset_2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;by "some common variable properly sorted";&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;if dset_1.var1 = dset_2.var1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;dset_1.&lt;/SPAN&gt;var2=&lt;SPAN&gt;dset_2.&lt;/SPAN&gt;var2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;dset_1.&lt;/SPAN&gt;var3=&lt;SPAN&gt;dset_2.&lt;/SPAN&gt;var3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; dset_1.var1= "Missing";&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN&gt;dset_1.var2= "Missing";&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;end;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Somebody please help me understand this. I tried various combinations nothing worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vinny.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 18:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/438970#M69115</guid>
      <dc:creator>VinnyR</dc:creator>
      <dc:date>2018-02-21T18:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Case WHEN....how to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439005#M69118</link>
      <description>&lt;P&gt;I don't know what 'contelled' is, but what do you want to happen if dset_1.var1 is not equal to dset_2.var1?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 17:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439005#M69118</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2018-02-21T17:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Case WHEN....how to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439007#M69119</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sorry about that...updated the information.Thanks for noticing and notifying.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vinny.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 18:03:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439007#M69119</guid>
      <dc:creator>VinnyR</dc:creator>
      <dc:date>2018-02-21T18:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Case WHEN....how to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439009#M69120</link>
      <description>&lt;P&gt;so you'd want to do a left join between the 2 tables.&amp;nbsp; Then your case statement can be something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;case when table2.var is missing then 'missing' else table2.var end&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 18:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439009#M69120</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2018-02-21T18:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Case WHEN....how to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439744#M69149</link>
      <description>You'll need a case for each var assignment, hence repeating of some logic - one little drawback for SQL over the data step.</description>
      <pubDate>Fri, 23 Feb 2018 16:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Case-WHEN-how-to/m-p/439744#M69149</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-02-23T16:02:40Z</dc:date>
    </item>
  </channel>
</rss>

