<?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 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-case-when/m-p/326736#M62339</link>
    <description>&lt;P&gt;Please supply some example data (&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;in a data step&lt;/A&gt;) for us to play around with, and so we get a feel for your data structure.&lt;/P&gt;
&lt;P&gt;And post the desired result.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2017 15:13:17 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-01-23T15:13:17Z</dc:date>
    <item>
      <title>proc sql case when</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-case-when/m-p/326731#M62336</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a new programmer and hope to get some help.I've already created a table. However, some codes can not be grabed because of the applicationdate not equal to codesdate. So I want to add the blank obs from the previous applicationdate.&amp;nbsp; I am not quite sure whether can I use proc sql case when like this as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;create table new as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select origianl*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when codes=' ', then rules.codes where codesdate=min(original.codesdate)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else original.codes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end as codes;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;whehter can I use other more simple logic for example data; set; My goal is to look back to the rules table where the codedate is min() when the codes are blank and the rest keep their original value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 15:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-case-when/m-p/326731#M62336</guid>
      <dc:creator>septemberbulb</dc:creator>
      <dc:date>2017-01-23T15:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql case when</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-case-when/m-p/326735#M62338</link>
      <description>&lt;P&gt;Start by posting some test data - in the form of a datastep. &amp;nbsp;Follow this post if you need to:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Secondly, your SQL statement is invalid in several ways, first you have no "from" clause, second&amp;nbsp;&lt;SPAN&gt;origianl* - is invalid.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Post what you have, and show what you want at the end. &amp;nbsp;Note you don't necessarily need to use SQL, but its hard to advise on the limited information you have provided.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 15:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-case-when/m-p/326735#M62338</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-23T15:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql case when</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-case-when/m-p/326736#M62339</link>
      <description>&lt;P&gt;Please supply some example data (&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;in a data step&lt;/A&gt;) for us to play around with, and so we get a feel for your data structure.&lt;/P&gt;
&lt;P&gt;And post the desired result.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 15:13:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-case-when/m-p/326736#M62339</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-01-23T15:13:17Z</dc:date>
    </item>
  </channel>
</rss>

