<?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 One to Many Merge Issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886007#M350123</link>
    <description>&lt;P&gt;I am trying to merge HPI score based on the zip code. However, it only shows up once instead of applying the score to each row. This code worked for other part of my coding but I am not sure why it's not working for this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[prefinal_missing]&lt;/P&gt;&lt;P&gt;orgID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hplzip ...&lt;/P&gt;&lt;P&gt;111112&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&lt;/P&gt;&lt;P&gt;111113&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&lt;/P&gt;&lt;P&gt;111114&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[HPI_hpl]&lt;/P&gt;&lt;P&gt;hplzip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HPIscore&lt;/P&gt;&lt;P&gt;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.026&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data=prefinal_missing; by hplzip; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data=HPI_hpl; by hplzip; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge prefinal_missing(in=in1) HPI_hpl;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by hplzip;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if in1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib _all_ label='';&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What comes out:&lt;/P&gt;&lt;P&gt;orgID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hplzip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HPIscore&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;111112&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.026&lt;/P&gt;&lt;P&gt;111113&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;111114&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want:&lt;/P&gt;&lt;P&gt;orgID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hplzip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HPIscore&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;111112&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.026&lt;/P&gt;&lt;P&gt;111113&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0.026&lt;/P&gt;&lt;P&gt;111114&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0.026&lt;/P&gt;</description>
    <pubDate>Sun, 23 Jul 2023 15:55:57 GMT</pubDate>
    <dc:creator>orchid_sugar</dc:creator>
    <dc:date>2023-07-23T15:55:57Z</dc:date>
    <item>
      <title>One to Many Merge Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886007#M350123</link>
      <description>&lt;P&gt;I am trying to merge HPI score based on the zip code. However, it only shows up once instead of applying the score to each row. This code worked for other part of my coding but I am not sure why it's not working for this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[prefinal_missing]&lt;/P&gt;&lt;P&gt;orgID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hplzip ...&lt;/P&gt;&lt;P&gt;111112&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&lt;/P&gt;&lt;P&gt;111113&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&lt;/P&gt;&lt;P&gt;111114&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[HPI_hpl]&lt;/P&gt;&lt;P&gt;hplzip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HPIscore&lt;/P&gt;&lt;P&gt;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.026&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data=prefinal_missing; by hplzip; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data=HPI_hpl; by hplzip; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge prefinal_missing(in=in1) HPI_hpl;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by hplzip;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if in1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib _all_ label='';&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What comes out:&lt;/P&gt;&lt;P&gt;orgID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hplzip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HPIscore&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;111112&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.026&lt;/P&gt;&lt;P&gt;111113&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;111114&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want:&lt;/P&gt;&lt;P&gt;orgID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hplzip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HPIscore&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;111112&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.026&lt;/P&gt;&lt;P&gt;111113&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0.026&lt;/P&gt;&lt;P&gt;111114&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90017&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0.026&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2023 15:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886007#M350123</guid>
      <dc:creator>orchid_sugar</dc:creator>
      <dc:date>2023-07-23T15:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: One to Many Merge Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886009#M350124</link>
      <description>&lt;P&gt;Your code works for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1690128709104.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86041i15251D4BA8AA205D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PaigeMiller_0-1690128709104.png" alt="PaigeMiller_0-1690128709104.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there errors in the log? Are the values of hplzip numeric or character? If character, are there unnecessary spaces before or after the characters? Or perhaps there are non-printable characters in some of the values of HPLZIP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From now on, please (EVERY SINGLE TIME) present data as working SAS data step code, such as this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HPI_hpl;
input hplzip HPIscore;
cards;
90017 0.026
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use this macro to create this working DATA step code for you: &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2023 16:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886009#M350124</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-07-23T16:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: One to Many Merge Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886010#M350125</link>
      <description>&lt;P&gt;That is usually caused by making the mistake of having the variable already existing in MANY dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
      merge prefinal_missing(in=in1 drop=hpiscore) HPI_hpl;
      by hplzip;
      if in1;
      attrib _all_ label='';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 23 Jul 2023 16:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886010#M350125</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-07-23T16:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: One to Many Merge Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886014#M350126</link>
      <description>&lt;P&gt;Use &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159" target="_blank" rel="noopener"&gt;Tom&lt;/A&gt;'s solution and note that by using&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;options msglevel=I;&lt;/PRE&gt;
&lt;P&gt;the MERGE step writes an &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/p17071zptzpruyn1a5hirqyle3r3.htm#p166lod9vi38kan1uz2h3hcu1kjf" target="_blank" rel="noopener"&gt;INFO message&lt;/A&gt; about this potential issue to the log:&lt;/P&gt;
&lt;PRE&gt;INFO: The variable HPIscore on data set WORK.PREFINAL_MISSING will be overwritten by data set WORK.HPI_HPL.&lt;/PRE&gt;
&lt;P&gt;Which should remind you to drop the conflicting variable from dataset PREFINAL_MISSING, as Tom has suggested, and hence avoid that log message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually, the INFO message describes that in the &lt;EM&gt;first&lt;/EM&gt; observation of a BY group the&amp;nbsp;&lt;FONT face="courier new,courier"&gt;HPIscore&lt;/FONT&gt;&amp;nbsp;from PREFINAL_MISSING is overwritten with the corresponding value from HPI_HPL (as desired). But the problem is that in the &lt;EM&gt;second&lt;/EM&gt; observation of the BY group the &lt;EM&gt;retained&lt;/EM&gt; value of &lt;FONT face="courier new,courier"&gt;HPIscore&lt;/FONT&gt;&amp;nbsp;from HPI_HPL is overwritten with the new value read from PREFINAL_MISSING and it is never restored, while more values from PREFINAL_MISSING are read in subsequent observations of the BY group -- apparently missing values in your case.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2023 17:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/One-to-Many-Merge-Issue/m-p/886014#M350126</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-07-23T17:22:09Z</dc:date>
    </item>
  </channel>
</rss>

