<?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: Unable to update more than one fields using PROC SQL: in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199301#M266653</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;I forgot to tell this. Records should not be sorted, since that file will be used by other projects as well. That's why I didn't tried merge concept. &lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Santhosh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Aug 2015 13:46:45 GMT</pubDate>
    <dc:creator>Santhoshcsc</dc:creator>
    <dc:date>2015-08-15T13:46:45Z</dc:date>
    <item>
      <title>Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199298#M266650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working in a DYL280 to SAS conversion project. I am facing few issues to complete this task. Please help me to overcome this. Thanks much in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Requirement is:&lt;/P&gt;&lt;P&gt;First lookup to select NAME and loc:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need to do a lookup between file1 and file2, whereas name was the key field. IF found between two files then update file1 by moving TLOC(in file2) TO ZIPCODE(in file1). &lt;/P&gt;&lt;P&gt;If not found then list 'NAME NOT FOUND' NAME in sas log(Note: value in the name field for that unmatched record should be written in the saslog as well) and reject that record . &lt;/P&gt;&lt;P&gt;And drop all unmatched records and update file1 with only matched records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DYL280 code:&lt;/P&gt;&lt;P&gt;****SELECT NAME****&lt;/P&gt;&lt;P&gt;BINSEARCH FILE2 NAME&lt;/P&gt;&lt;P&gt;IFFOUND EQ 'Y' NEXT&lt;/P&gt;&lt;P&gt;ELSE LIST 'NAME NOT FOUND' NAME&lt;/P&gt;&lt;P&gt;GOTO NEXTRECORD ENDIF&lt;/P&gt;&lt;P&gt;MOVE TLOC TO ZIPCODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second lookup between file1 and file3, where as DEPT was the key field. IF found between two files AND TAREA1 NOT EQUAL TO 'AYA' then update file1 by moving TAREA2(in file2) TO TAREA(in file1) and AREADESC(in file2) TO LDESC(in file1). &lt;/P&gt;&lt;P&gt;If not found and TAREA1 EQ 'AYA'&amp;nbsp; then list 'DEPT NOT FOUND IN FILE3' DEPT in sas log.And drop all unmatched records and update file1 with only matched records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;****REJECT ANY DEPT CCS, GET CC DECS****&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BINSEARCH FILE3 DEPT&lt;/P&gt;&lt;P&gt;IFFOUND EQ 'Y' NEXT&lt;/P&gt;&lt;P&gt;ELSE LIST 'DEPT NOT FOUND IN FILE3' DEPT&lt;/P&gt;&lt;P&gt;GOTO NEXTRECORD ENDIF&lt;/P&gt;&lt;P&gt;IF TAREA1 EQ 'AYA' GOTO READMAST ENDIF&lt;/P&gt;&lt;P&gt;MOVE TAREA2 TO TAREA&lt;/P&gt;&lt;P&gt;MOVE AREADESC TO LDESC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS code we tried for first logic: But unable to drop unmatched records and update more than one variable at a time. And unable to list down the nonmatched field value in SAS log.&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; update file1 as A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set zipcode = (select tloc from file2 as B&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where b.Tname = A.Name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input file layout and sample records:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data file1;&lt;/P&gt;&lt;P&gt;input&lt;/P&gt;&lt;P&gt;@01 Name&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; $12.&lt;/P&gt;&lt;P&gt;@14 zipcode&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 05.&lt;/P&gt;&lt;P&gt;@20 Area1&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; $03.&lt;/P&gt;&lt;P&gt;@23 dept&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;&amp;nbsp; 04.&lt;/P&gt;&lt;P&gt;@28 ldper&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; 02.&lt;/P&gt;&lt;P&gt;@30 ldesc&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; 30.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;JohnAbraham&amp;nbsp; 80000 AY 1900 09&lt;/P&gt;&lt;P&gt;Madisson&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 75200 AY 1825 01&lt;/P&gt;&lt;P&gt;Murphy&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 95210 AY 1952 06&lt;/P&gt;&lt;P&gt;Donaldmathew 65214 NY 6854 18&lt;/P&gt;&lt;P&gt;Eric&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 85102 NA 7889 24&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data File2;&lt;/P&gt;&lt;P&gt;input&lt;/P&gt;&lt;P&gt;@01 TName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $12.&lt;/P&gt;&lt;P&gt;@13 Tloc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 05.&lt;/P&gt;&lt;P&gt;@18 tarea1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $03.&lt;/P&gt;&lt;P&gt;@21 tdept1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04.;&lt;/P&gt;&lt;P&gt;datalines; &lt;/P&gt;&lt;P&gt;Mathews55589 LA 1980 10&lt;/P&gt;&lt;P&gt;Jonny&amp;nbsp; 75200 LA 1825 01&lt;/P&gt;&lt;P&gt;David&amp;nbsp; 87510 HT 1952 06&lt;/P&gt;&lt;P&gt;Edrick 65214 LO 6854 18&lt;/P&gt;&lt;P&gt;Monaay 74502 NA 7889 24&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data File3;&lt;/P&gt;&lt;P&gt;input&lt;/P&gt;&lt;P&gt;@01 Tloc1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 05.&lt;/P&gt;&lt;P&gt;@07 tarea2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $03.&lt;/P&gt;&lt;P&gt;@10 tdept2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04.&lt;/P&gt;&lt;P&gt;@14 areadesc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30.;&lt;/P&gt;&lt;P&gt;datalines; &lt;/P&gt;&lt;P&gt;55589 LA 1980 10 SOUTHEREN CALIFORNIA&lt;/P&gt;&lt;P&gt;75200 LA 1825 01&lt;/P&gt;&lt;P&gt;87510 HT 1952 06 EASTERAN BAY&lt;/P&gt;&lt;P&gt;65214 LO 6854 18 NEWYORK&lt;/P&gt;&lt;P&gt;74502 NA 7889 24 WASHINGTON.;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Aug 2015 15:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199298#M266650</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-14T15:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199299#M266651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is one idea rather than the proc sql subquery update method you have above:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table file_out as&lt;/P&gt;&lt;P&gt;select a.Name,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when b.tloc ^= . then b.tloc else a.zipcode end as zipcode,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when c.tedpt2 ^= . and b.tarea1 ^= 'AYA' then c.tarea2 else a.area1 end as area1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.dept,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.ldper,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when c.tdept2 ^= . and b.tarea1 ^= 'AYA' then c.areadesc else a.ldesc end as ldesc,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when b.tloc = . then 1 else 0 end as miss_ind_21,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when c.tdept2 = . then 1 else 0 end as miss_ind_32&lt;/P&gt;&lt;P&gt;from file1 a left join file2 b on a.name = b.tname&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join file3 c on a.dept = c.tdept2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data final_file(drop=op miss_ind_21 miss_ind_32);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set file_out;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length op $70;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if miss_ind_21 = 1 then do;&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; op = 'NAME NOT FOUND: '||name;&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; put op;&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; delete;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if miss_ind_32 = 1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; op = 'DEPT NOT FOUND IN FILE3 '||dept;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put op;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Aug 2015 20:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199299#M266651</guid>
      <dc:creator>Sonywell</dc:creator>
      <dc:date>2015-08-14T20:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199300#M266652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a possible solution for your first lookup, the second one is similar and you are encouraged to give a shot yourself.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=file1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=file2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; file1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;merge&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; file1(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=f1) file2(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=name Tloc &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;rename&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=(Tloc=zipcode) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=f2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; f2 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;put&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'NAME NOT FOUND: '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; f1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; f2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; Good Luck,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Aug 2015 20:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199300#M266652</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-08-14T20:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199301#M266653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;I forgot to tell this. Records should not be sorted, since that file will be used by other projects as well. That's why I didn't tried merge concept. &lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Santhosh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2015 13:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199301#M266653</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-15T13:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199302#M266654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Hi Sonywell, &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Thank you so much. I gave a try with your logic, but it didn't went well.Getting some unmatched records as well in the output. &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Requirement is we need to do a lookup between two files using a key field, if found then move file2 value to file 1.(Here two fields values in file1 should be updated with file2 field if key matches) Else move &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;'DEPT NOT FOUND IN FILE3 '||dept in sas log. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Main thing is we should not sort the files, so as you mentioned we can use PROC SQL only for this task. But unfortunately its not working fine. Please guide me.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2015 14:02:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199302#M266654</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-15T14:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199303#M266655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the original order needs to be kept, the SQL is the LAST thing you want to use. SQL only has two types of output: 1. Sorted (defined by 'order by'). 2.God knows what. I will lay out some idea, it may need some reading/learning, but it can be easily implemented. Take your first lookup for instance:&lt;/P&gt;&lt;P&gt;1. Use file1 to start a data step&lt;/P&gt;&lt;P&gt;2. upload needed components from file2 to a Hash table, use 'name' as key.&lt;/P&gt;&lt;P&gt;3. When lookup failed, print error log, else output to a new file1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You certainly can upload file3 to another Hash table and finish both lookup in one pass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The hash method will require your computer RAM is large enough to host either file2 or file3 or both if one pass. Although lookup can be done between many to many, it may not give your desired results, so file2/3 usually need to be unique on 'name'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2015 00:16:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199303#M266655</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-08-16T00:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199304#M266656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sounds like you have a master file (FILE1) and two transactions files (FILE2 and FILE3).&lt;/P&gt;&lt;P&gt;You should merge FILE1 with FILE2 using NAME to see which records in FILE2 are found in FILE1.&amp;nbsp; You can then use the matched records to update and the unmatched to report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data update1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; merge file2 (in=in1) file2 (keep=name in=in2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; by name ;&lt;/P&gt;&lt;P&gt; if in1 ;&lt;/P&gt;&lt;P&gt; if not in2 then put name= :$quote. 'not found in FILE1.' ;&lt;/P&gt;&lt;P&gt; else output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql noprint ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; update FILE1 set ZIPCODE = (select TLOC from update1 where FILE1.name = update1.name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; where name in (select name from update1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2015 05:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199304#M266656</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-16T05:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199305#M266657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I can use merge concept, but in the requirement i should not sort the masterf file. Can we merge two files without sorting it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2015 14:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199305#M266657</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-16T14:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199306#M266658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not get the concepts of DYL-280. It looks to the question on file-record processing. &lt;BR /&gt;The @ usage in the samples is looking for me to be&amp;nbsp; on mainframe fixed records processing. I that correct?&lt;/P&gt;&lt;P&gt;&amp;nbsp; The remark as the files are used for other projects is pointing in that direction.is&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In that case use data-step views to describe the records so you can process them afterwards.&amp;nbsp;&amp;nbsp;&amp;nbsp; This will avoid as much of the IO as possible.&lt;BR /&gt;A direct search with proc SQL on a datastep view can behave rather well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As the SAS approach is normally updating complete tables I want to know about that binary search with DYL-280 and updating one record. &lt;BR /&gt;What are all used techniques used in for us understandable words?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2015 15:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199306#M266658</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-08-16T15:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199307#M266659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jaap,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Bin search means in DYL280 means as follows, Need to do lookup between two flat files. If key is found then need to move field2 value to field1 value in File1, else need towrite hardcoded value into SAS log and process next records. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example: &lt;/P&gt;&lt;P&gt;file1:&lt;/P&gt;&lt;P&gt;NAME&lt;/P&gt;&lt;P&gt;AREA&lt;/P&gt;&lt;P&gt;ZIPCODE&lt;/P&gt;&lt;P&gt;File2:&lt;/P&gt;&lt;P&gt;Name2&lt;/P&gt;&lt;P&gt;ARE2&lt;/P&gt;&lt;P&gt;ZIPCODE2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key field is NAME;&lt;/P&gt;&lt;P&gt;IF NAME field was found between two files then update AREA field in file1 with value in AREA2 field, else Write :Value not found " into SASLOG. and goto next record.&lt;/P&gt;&lt;P&gt;Note: Records in file2 should not be appened to file1 after lookup processing.&lt;/P&gt;&lt;P&gt;Please let me know, if I didn't make it clear.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2015 16:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199307#M266659</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-16T16:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to update more than one fields using PROC SQL:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199308#M266660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok reading and processing flat files not databases or sas-datasets. That is an important pre-req.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Processing a flat file (searching) is possible when you define a view to that &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#n07vq6hmss6f67n1vhnnn5cw0chh.htm" title="http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#n07vq6hmss6f67n1vhnnn5cw0chh.htm"&gt;SAS(R) 9.4 Language Reference: Concepts, Fifth Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Updating flat-files in place (record oriented) is possible. &lt;A href="http://support.sas.com/kb/24/782.html" title="http://support.sas.com/kb/24/782.html"&gt;24782 - Update an external file in place&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Dropping records however is not possible with flat file processing. You can read it all and create a new one.&amp;nbsp; PDSE or using a GDG - batch processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What environment are you? &lt;/P&gt;&lt;P&gt; Is that a/ Mainframe and which b/ sas release you are using c/ using classical bound data set or a HFS approach?&lt;/P&gt;&lt;P&gt; What is the sizing of those flat files (no records/vars) , should it run interactively or only in batch&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When rewriting the flat files and performance is not a problem you can read/convert them to SAS sort as you like with an ordering indicator (making&amp;nbsp; _n_&amp;nbsp; permanent) reorder back (sort) before writing out. That is the most easy understandable coding. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 04:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-update-more-than-one-fields-using-PROC-SQL/m-p/199308#M266660</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-08-17T04:52:16Z</dc:date>
    </item>
  </channel>
</rss>

