<?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: SAS Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606076#M175952</link>
    <description>&lt;P&gt;Alternatively try the merge step to overwrite the target values in amt variable with source dataset amt variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data target;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 89 18NOV2019 19NOV2019
;
run;

data source;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 54 18NOV2019 19NOV2019
;
run;

proc sort data=target;
by num sourcedate loaddate;
run;

proc sort data=source;
by num sourcedate loaddate;
run;

data want;
merge target(in=a) source(in=b);
by num sourcedate loaddate;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 21 Nov 2019 10:54:34 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2019-11-21T10:54:34Z</dc:date>
    <item>
      <title>SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606067#M175945</link>
      <description>&lt;P&gt;Hi ,&lt;BR /&gt;please have a look on below sample data and please help&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data source;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 89 18NOV2019 19NOV2019
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data target;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 89 18NOV2019 19NOV2019
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;incorrect data is there in source dataset for date 18NOV2019&lt;BR /&gt;which got alreday loaded into target table.&lt;BR /&gt;so now the souce data will become as below.;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data source;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 54 18NOV2019 19NOV2019
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So target dataset now should show as below output(changed from 89 to 54) when i run below code;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data target;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 54 18NOV2019 19NOV2019
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would want to do this using proc sql option.kindly help&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 10:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606067#M175945</guid>
      <dc:creator>JJP1</dc:creator>
      <dc:date>2019-11-21T10:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606072#M175949</link>
      <description>&lt;P&gt;In SQL, use update:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data target;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 89 18NOV2019 19NOV2019
;
run;

data source;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 54 18NOV2019 19NOV2019
;
run;

proc sql;
update target t
set amt = (select amt from source s where t.num = s.num and t.sourcedate = s.sourcedate)
;
quit;

proc print data=target noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;num    amt    sourcedate    loaddate

 1      32    19NOV2019     20NOV2019
 2      45    19NOV2019     20NOV2019
 3      54    18NOV2019     19NOV2019
&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Nov 2019 10:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606072#M175949</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-21T10:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606076#M175952</link>
      <description>&lt;P&gt;Alternatively try the merge step to overwrite the target values in amt variable with source dataset amt variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data target;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 89 18NOV2019 19NOV2019
;
run;

data source;
input num $1. amt sourcedate $10. loaddate $10.;
datalines;
1 32 19NOV2019 20NOV2019
2 45 19NOV2019 20NOV2019
3 54 18NOV2019 19NOV2019
;
run;

proc sort data=target;
by num sourcedate loaddate;
run;

proc sort data=source;
by num sourcedate loaddate;
run;

data want;
merge target(in=a) source(in=b);
by num sourcedate loaddate;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Nov 2019 10:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606076#M175952</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-11-21T10:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606102#M175961</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; .&lt;BR /&gt;Would you please suggest whether we can do it using proc sql (like left join ,right join,inner join) and get the same target table desired ?.&lt;BR /&gt;As i would want to see in this way just to see any possiblity .&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 12:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606102#M175961</guid>
      <dc:creator>JJP1</dc:creator>
      <dc:date>2019-11-21T12:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606107#M175964</link>
      <description>&lt;P&gt;Maxim 14: Use the Right Tool. In SQL, this is update.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 13:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dataset/m-p/606107#M175964</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-21T13:00:52Z</dc:date>
    </item>
  </channel>
</rss>

