<?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 2 fields conditionally at the same time ? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-update-2-fields-conditionally-at-the-same-time/m-p/10444#M995</link>
    <description>Dear all,&lt;BR /&gt;
Do you know whether it is possible to update conditionnally 2 fields in the same sql update statement  ?&lt;BR /&gt;
This kind of synthax gives an error :&lt;BR /&gt;
&lt;BR /&gt;
proc sql &amp;amp;statusql noprint; &lt;BR /&gt;
  update decava.person &lt;BR /&gt;
     set death_date  = (select iden_mortaldate from &lt;BR /&gt;
     ident_sel_1 where ident_sel_1.iden_inss = person.social_security_nr)  where exists ( select iden_mortaldate from ident_sel_1 &lt;BR /&gt;
          where ident_sel_1.iden_inss = person.social_security_nr)  , &lt;BR /&gt;
         smals_last_update_date  = (select iden_lastupdt_datetime  from &lt;BR /&gt;
     ident_sel_1 where ident_sel_1.iden_inss = person.social_security_nr) &lt;BR /&gt;
  where exists ( select iden_lastupdt_datetime from ident_sel_1 &lt;BR /&gt;
          where ident_sel_1.iden_inss = person.social_security_nr) &lt;BR /&gt;
           ; &lt;BR /&gt;
quit; &lt;BR /&gt;
&lt;BR /&gt;
Without the where exists statements, an ORACLE error occurs.&lt;BR /&gt;
&lt;BR /&gt;
Any idea is welcome.&lt;BR /&gt;
&lt;BR /&gt;
Valérie</description>
    <pubDate>Tue, 15 Feb 2011 15:55:48 GMT</pubDate>
    <dc:creator>sbxvab</dc:creator>
    <dc:date>2011-02-15T15:55:48Z</dc:date>
    <item>
      <title>proc sql update 2 fields conditionally at the same time ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-update-2-fields-conditionally-at-the-same-time/m-p/10444#M995</link>
      <description>Dear all,&lt;BR /&gt;
Do you know whether it is possible to update conditionnally 2 fields in the same sql update statement  ?&lt;BR /&gt;
This kind of synthax gives an error :&lt;BR /&gt;
&lt;BR /&gt;
proc sql &amp;amp;statusql noprint; &lt;BR /&gt;
  update decava.person &lt;BR /&gt;
     set death_date  = (select iden_mortaldate from &lt;BR /&gt;
     ident_sel_1 where ident_sel_1.iden_inss = person.social_security_nr)  where exists ( select iden_mortaldate from ident_sel_1 &lt;BR /&gt;
          where ident_sel_1.iden_inss = person.social_security_nr)  , &lt;BR /&gt;
         smals_last_update_date  = (select iden_lastupdt_datetime  from &lt;BR /&gt;
     ident_sel_1 where ident_sel_1.iden_inss = person.social_security_nr) &lt;BR /&gt;
  where exists ( select iden_lastupdt_datetime from ident_sel_1 &lt;BR /&gt;
          where ident_sel_1.iden_inss = person.social_security_nr) &lt;BR /&gt;
           ; &lt;BR /&gt;
quit; &lt;BR /&gt;
&lt;BR /&gt;
Without the where exists statements, an ORACLE error occurs.&lt;BR /&gt;
&lt;BR /&gt;
Any idea is welcome.&lt;BR /&gt;
&lt;BR /&gt;
Valérie</description>
      <pubDate>Tue, 15 Feb 2011 15:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-update-2-fields-conditionally-at-the-same-time/m-p/10444#M995</guid>
      <dc:creator>sbxvab</dc:creator>
      <dc:date>2011-02-15T15:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql update 2 fields conditionally at the same time ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-update-2-fields-conditionally-at-the-same-time/m-p/10445#M996</link>
      <description>Hi Valérie,&lt;BR /&gt;
&lt;BR /&gt;
Could you please check whether the following code match your expectations ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
I hope it helps !&lt;BR /&gt;
&lt;BR /&gt;
Kind regards,&lt;BR /&gt;
Florent&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
	update decava.person a&lt;BR /&gt;
	set death_date =   (select iden_mortaldate&lt;BR /&gt;
						from ident_sel_1&lt;BR /&gt;
						where iden_inss = a.social_security_nr),&lt;BR /&gt;
	    smals_last_update_date =   (select iden_lastupdt_datetime&lt;BR /&gt;
									from ident_sel_1&lt;BR /&gt;
									where iden_inss = a.social_security_nr)&lt;BR /&gt;
	where a.social_security_nr in (select iden_inss&lt;BR /&gt;
									from ident_sel_1)&lt;BR /&gt;
	;&lt;BR /&gt;
quit;</description>
      <pubDate>Tue, 15 Feb 2011 18:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-update-2-fields-conditionally-at-the-same-time/m-p/10445#M996</guid>
      <dc:creator>Florent</dc:creator>
      <dc:date>2011-02-15T18:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql update 2 fields conditionally at the same time ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-update-2-fields-conditionally-at-the-same-time/m-p/10446#M997</link>
      <description>Hi Valérie,&lt;BR /&gt;
&lt;BR /&gt;
I tested your code (excluding those supplementary where conditions) on SAS datasets and it seems to work fine. I would say you'd better and faster try to ask a question to SAS technical support about that. &lt;BR /&gt;
&lt;BR /&gt;
Warm regards,&lt;BR /&gt;
Vasile</description>
      <pubDate>Tue, 15 Feb 2011 23:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-update-2-fields-conditionally-at-the-same-time/m-p/10446#M997</guid>
      <dc:creator>Vasile01</dc:creator>
      <dc:date>2011-02-15T23:18:38Z</dc:date>
    </item>
  </channel>
</rss>

