<?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 merge question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709251#M218060</link>
    <description>&lt;P&gt;What did you expect the output to be?&amp;nbsp; Perhaps we can help you better if we see how you might be thinking.&amp;nbsp; We can focus on what part of your hypothesis is incorrect.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Jan 2021 17:17:35 GMT</pubDate>
    <dc:creator>PhilC</dc:creator>
    <dc:date>2021-01-04T17:17:35Z</dc:date>
    <item>
      <title>SAS merge question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709247#M218057</link>
      <description>&lt;P&gt;When I run below code. I found only the first record of a column is populated by 'A' and other records are keeping blank for a column. Does someone help me to understand the reason? Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;BR /&gt;a=' ';&lt;BR /&gt;b=1;&lt;BR /&gt;do i=1 to 10;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;data b;&lt;BR /&gt;a='A';&lt;BR /&gt;b=1;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=a; by b;run;&lt;BR /&gt;proc sort data=b; by b; run;&lt;BR /&gt;data c;&lt;BR /&gt;merge a b;&lt;BR /&gt;by b;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2021 17:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709247#M218057</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2021-01-04T17:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS merge question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709249#M218058</link>
      <description>&lt;P&gt;SAS copies the values from a dataset only once.&amp;nbsp; So for the first observation it reads variables A and B from dataset WORK.A and then overwrites the values read with the values read from WORK.B.&amp;nbsp; But on the other observation there are no more records to read from WORK.B so the values read from WORK.A are not overwritten.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to only keep the value of A from WORK.B then drop the variable from WORK.A.&amp;nbsp; You could do it in the step with the MERGE by using the DROP= dataset option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data c;
  merge a(drop=a) b;
  by b;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jan 2021 17:10:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709249#M218058</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-04T17:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS merge question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709251#M218060</link>
      <description>&lt;P&gt;What did you expect the output to be?&amp;nbsp; Perhaps we can help you better if we see how you might be thinking.&amp;nbsp; We can focus on what part of your hypothesis is incorrect.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2021 17:17:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709251#M218060</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-04T17:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS merge question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709264#M218068</link>
      <description>Thanks a lot. I thought sas read datasets into Program Data Vector(PDV). each time dataset b will overwrite dataset a. so a column should be all populated finally.</description>
      <pubDate>Mon, 04 Jan 2021 18:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-merge-question/m-p/709264#M218068</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2021-01-04T18:25:25Z</dc:date>
    </item>
  </channel>
</rss>

