<?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 PROC SQL - UPDATE WITHOUT OVERWRITING WITH MISSING VALUES in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE-WITHOUT-OVERWRITING-WITH-MISSING-VALUES/m-p/365695#M86887</link>
    <description>&lt;P&gt;&lt;SPAN class="DateTime lia-message-posted-on lia-component-common-widget-date"&gt;I am trying to update a master table with a reference table but my reference table isn't&amp;nbsp;perfect and I don't want it to overwrite my master table if it's missing some of the devices I need. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-right lia-quilt-column-main-right"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;I was thinking&amp;nbsp; when I submit the following code it wouldn't update my speeds in my master table if&amp;nbsp;they&amp;nbsp;weren't in my reference table but it seems to still set my master table values&amp;nbsp;to missing if&amp;nbsp;they are&amp;nbsp;not in the reference table. Am I missing something? &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;update&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;mastertable tableA&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; speed = (select Speed&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;from referencetable&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; (tableA.device = device and tablea.daydate between min_daydate AND max_daydate));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; device in(select device from referencetable);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 09 Jun 2017 14:32:39 GMT</pubDate>
    <dc:creator>kmcnulty</dc:creator>
    <dc:date>2017-06-09T14:32:39Z</dc:date>
    <item>
      <title>PROC SQL - UPDATE WITHOUT OVERWRITING WITH MISSING VALUES</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE-WITHOUT-OVERWRITING-WITH-MISSING-VALUES/m-p/365695#M86887</link>
      <description>&lt;P&gt;&lt;SPAN class="DateTime lia-message-posted-on lia-component-common-widget-date"&gt;I am trying to update a master table with a reference table but my reference table isn't&amp;nbsp;perfect and I don't want it to overwrite my master table if it's missing some of the devices I need. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-right lia-quilt-column-main-right"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;I was thinking&amp;nbsp; when I submit the following code it wouldn't update my speeds in my master table if&amp;nbsp;they&amp;nbsp;weren't in my reference table but it seems to still set my master table values&amp;nbsp;to missing if&amp;nbsp;they are&amp;nbsp;not in the reference table. Am I missing something? &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;update&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;mastertable tableA&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; speed = (select Speed&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;from referencetable&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; (tableA.device = device and tablea.daydate between min_daydate AND max_daydate));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; device in(select device from referencetable);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 09 Jun 2017 14:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE-WITHOUT-OVERWRITING-WITH-MISSING-VALUES/m-p/365695#M86887</guid>
      <dc:creator>kmcnulty</dc:creator>
      <dc:date>2017-06-09T14:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - UPDATE WITHOUT OVERWRITING WITH MISSING VALUES</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE-WITHOUT-OVERWRITING-WITH-MISSING-VALUES/m-p/365755#M86913</link>
      <description>&lt;P&gt;I figured it out!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;update&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mastertable tableA&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; speed = case when device in (select device from referencetable) then (select Speed&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;from referencetable&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; (tableA.device = device and tablea.daydate ge min_daydate and tablea.daydate lt max_daydate)) else speed end; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; device in (select device from referencetable);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 16:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE-WITHOUT-OVERWRITING-WITH-MISSING-VALUES/m-p/365755#M86913</guid>
      <dc:creator>kmcnulty</dc:creator>
      <dc:date>2017-06-09T16:11:02Z</dc:date>
    </item>
  </channel>
</rss>

