<?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 statement based on Join condition not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920064#M362385</link>
    <description>&lt;PRE&gt;&lt;CODE class=""&gt;data test;
	set sashelp.class;
	age=.;
run;

proc sql;
	update test a
		set age = (select age from sashelp.class as b where a.name = b.name);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can you try something similar to this?&lt;BR /&gt;&lt;BR /&gt;Create a temporary table first where you select the max description and use that table in the set statement.&lt;BR /&gt;&lt;BR /&gt;If you have some sample data, please share it, and I can show you a practical example with your data.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2024 07:41:37 GMT</pubDate>
    <dc:creator>Mazi</dc:creator>
    <dc:date>2024-03-13T07:41:37Z</dc:date>
    <item>
      <title>Update statement based on Join condition not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920063#M362384</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Any help to resolve this issue? Getting an error like unexpected 'on' at line number 4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;update pre_claim_lin_1_test pci
set pci.LINE_DIA_PRIM_DESC = diag.description 
from (select max(description) description from COMDB.ON_DATA.MR_DIAGNOSIS_CODE c inner join raw.prepa_claim_inst r on r.PRINCIPAL_DIAG = c.DIAGNOSI_CODE
where  c.ICD1_INDICATOR&amp;lt;&amp;gt;'N')diag on 1=1 and pci.id  =7828 ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;​If I tried to remove ON and add WHERE, I'm getting an error like invalid&amp;nbsp; field diag.description&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;update pre_claim_lin_1_test pci
set pci.LINE_DIA_PRIM_DESC = diag.description 
from (select max(description) description from COMDB.ON_DATA.MR_DIAGNOSIS_CODE c inner join raw.prepa_claim_inst r on r.PRINCIPAL_DIAG = c.DIAGNOSI_CODE
where  c.ICD1_INDICATOR&amp;lt;&amp;gt;'N')diag where pci.id  =7828 ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 07:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920063#M362384</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2024-03-13T07:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement based on Join condition not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920064#M362385</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;data test;
	set sashelp.class;
	age=.;
run;

proc sql;
	update test a
		set age = (select age from sashelp.class as b where a.name = b.name);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can you try something similar to this?&lt;BR /&gt;&lt;BR /&gt;Create a temporary table first where you select the max description and use that table in the set statement.&lt;BR /&gt;&lt;BR /&gt;If you have some sample data, please share it, and I can show you a practical example with your data.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 07:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920064#M362385</guid>
      <dc:creator>Mazi</dc:creator>
      <dc:date>2024-03-13T07:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement based on Join condition not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920066#M362386</link>
      <description>&lt;P&gt;Please post the complete log, so we can see the position of the error indicator.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 07:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920066#M362386</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-03-13T07:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement based on Join condition not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920067#M362387</link>
      <description>&lt;P&gt;Replace the &amp;lt;&amp;gt; with the NE mnemonic. In SAS, &amp;lt;&amp;gt; is the MAX operator.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 07:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-based-on-Join-condition-not-working/m-p/920067#M362387</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-03-13T07:48:18Z</dc:date>
    </item>
  </channel>
</rss>

