<?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: Update only new values with conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435573#M282021</link>
    <description>&lt;P&gt;I solved with Data steps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data novos;
set WORK.NEWValues;
run;

data DIST_DDC.List;
modify DIST_DDC.List;
	by Tag;
	Último_Disparo= MAX(Último_Disparo, Último_Disparo_new);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Only modify the new values with a condition MAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your attention.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2018 09:44:40 GMT</pubDate>
    <dc:creator>Aleixo</dc:creator>
    <dc:date>2018-02-09T09:44:40Z</dc:date>
    <item>
      <title>Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435303#M282013</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to update a table (one column) from WORK.FILTER_FOR_TESTE_NOVA_LISTADISJU&amp;nbsp;but only new values(not same values)&amp;nbsp;with a condition.&lt;/P&gt;&lt;P&gt;With this next code the column is all updated with new value and the others values changed to NULL because the condition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i want is change only the new value on&amp;nbsp;the column&amp;nbsp;with these conditions and not all column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
title 'Nova Lista Disjuntores';
create table WORK.Nova_Lista_Disjuntores as
	select * from DIST_DDC.DDC_APA_LISTADISJUNTORESRND;
update WORK.Nova_Lista_Disjuntores as u
	set Último_Disparo=(select Último_Disparo from WORK.FILTER_FOR_TESTE_NOVA_LISTADISJU as n where u.Tag=n.Tag AND u.Último_Disparo &amp;lt; n.Último_Disparo)
	where u.Último_Disparo in (select Último_Disparo from WORK.FILTER_FOR_TESTE_NOVA_LISTADISJU);
	select Último_Disparo from WORK.Nova_Lista_Disjuntores;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;BR /&gt;Aleixo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 15:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435303#M282013</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-02-08T15:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435316#M282014</link>
      <description>&lt;P&gt;Can you provide a few records from DIST_DDC&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;DDC_APA_LISTADISJUNTORESRND and WORK&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;FILTER_FOR_TESTE_NOVA_LISTADISJU&amp;nbsp;(or something that looks like them if the data is sensitive),&amp;nbsp;what the result should look like (we&amp;nbsp;really can't&amp;nbsp;tell what "new" is)&amp;nbsp;and tell us if there is a primary key or unique record identifier&amp;nbsp;for the DIST_DDC&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;DDC_APA_LISTADISJUNTORESRND&amp;nbsp; data set?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:10:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435316#M282014</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-08T16:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435324#M282015</link>
      <description>&lt;P&gt;Why not simplify your code a lot and use datastep:&lt;/P&gt;
&lt;PRE&gt;data nova_lista_disjuntores;
  set nova_lista_disjuntores;
  if &amp;lt;condition&amp;gt; then ...;
  if &amp;lt;condition&amp;gt; then ...;
  if &amp;lt;condition&amp;gt; then ...;
run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435324#M282015</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-08T16:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435325#M282016</link>
      <description>&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to change not a column but only a row in that column. The code for that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; Último_Disparo&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; Último_Disparo &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; WORK&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;FILTER_FOR_TESTE_NOVA_LISTADISJU as &lt;SPAN class="token function"&gt;n&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; u&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;Tag&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;Tag AND u&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;Último_Disparo &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;Último_Disparo&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Tag is a unique identifier&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Table DDC&lt;BR /&gt;          TAG   Último_Disparo
XXXX YYYY ZZZZZ 01SEP2015
XXXX YYYY ZZZZZ 31JAN2015

Table WORK.FILTER......&lt;BR /&gt;          TAG&amp;nbsp;&amp;nbsp; Último_Disparo
XXXX YYYY ZZZZZ 01SEP2015
XXXX YYYY ZZZZZ 31JAN2017

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;What i want is update the second line in DDC with the new value(new date early)&amp;nbsp; from Work.filter......... and keep in talbe DDC the first line because not changed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Regards,&lt;BR /&gt;Aleixo&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435325#M282016</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-02-08T16:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435334#M282017</link>
      <description>&lt;P&gt;That code could change only a row in a column(nova_lista_disjuntores)?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435334#M282017</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-02-08T16:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435338#M282018</link>
      <description>&lt;P&gt;The main idea is compare 2 diferent columns and change some rows, not all rows of the column&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435338#M282018</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-02-08T16:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435560#M282019</link>
      <description>&lt;P&gt;Follow the guidance on posting a question.&amp;nbsp; Provide some test data in the form of a datastep so that we have something to run on.&amp;nbsp; Secondly show what you expect as output and describe the process between.&amp;nbsp; I have no idea from what you have posted what your trying to do - "&lt;SPAN&gt;The main idea is compare 2 diferent columns and change some rows," - this is conditional logic, which you can do in a datastep just like you would in SQL, remember your programming in SAS not SQL, so good idea to learn the language you are working in before trying to use additional components like SQL.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 09:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435560#M282019</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-09T09:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435566#M282020</link>
      <description>&lt;P&gt;Thank you for your advise. i am new with sas an also sql. I will pay attention to SAS programming and not so sql.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 09:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435566#M282020</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-02-09T09:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Update only new values with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435573#M282021</link>
      <description>&lt;P&gt;I solved with Data steps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data novos;
set WORK.NEWValues;
run;

data DIST_DDC.List;
modify DIST_DDC.List;
	by Tag;
	Último_Disparo= MAX(Último_Disparo, Último_Disparo_new);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Only modify the new values with a condition MAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your attention.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 09:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-only-new-values-with-conditions/m-p/435573#M282021</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-02-09T09:44:40Z</dc:date>
    </item>
  </channel>
</rss>

