<?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: Syntax/code to replace an observation with its related observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582913#M165877</link>
    <description>Can you have R in the text as well?&lt;BR /&gt;It's easy to do for your example data but the solution won't scale to your actual data if we don't know the remaining details.  I think you need to provide more sample data that better reflects your actual data.</description>
    <pubDate>Wed, 21 Aug 2019 17:40:18 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-08-21T17:40:18Z</dc:date>
    <item>
      <title>Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582906#M165871</link>
      <description>&lt;P&gt;id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BLK&lt;/P&gt;&lt;P&gt;AF120&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.02&lt;/P&gt;&lt;P&gt;AF120R&lt;/P&gt;&lt;P&gt;BD111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.5&lt;/P&gt;&lt;P&gt;BD111R&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the above question I&amp;nbsp; want to &lt;SPAN class="lia-search-match-lithium"&gt;replace&lt;/SPAN&gt; the missing BLK observation&amp;nbsp;with the BLK&amp;nbsp;of the related id&lt;/P&gt;&lt;P&gt;what would be the syntax in sas 9.4?&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;BLK value for AF120R&amp;nbsp;eq to that of AF120, 0.02, and so on.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 17:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582906#M165871</guid>
      <dc:creator>ts1993</dc:creator>
      <dc:date>2019-08-21T17:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582907#M165872</link>
      <description>Will you always have the pattern of Data, Missing, Data, Missing? Will the related variable always have the same prefix except with an R at the end?&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Aug 2019 17:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582907#M165872</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T17:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582909#M165873</link>
      <description>&lt;P&gt;No, the missing data does not have any pattern, every then and there&lt;/P&gt;&lt;P&gt;Yes, the related variable always have the same prefix except R or R1, R2, R3, etc. at the end, mostly just R&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 17:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582909#M165873</guid>
      <dc:creator>ts1993</dc:creator>
      <dc:date>2019-08-21T17:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582911#M165875</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input id $            BLK;
cards;
AF120     0.02
AF120R .
BD111     0.5
BD111R  .
;
proc sql;
create table want as
select a.id,b.blk
from have a left join (select * from have(where=(blk&amp;gt;.))) b
on find(a.id,strip(b.id))&amp;gt;0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Safe bet&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input id $            BLK;
cards;
AF120     0.02
AF120R .
BD111     0.5
BD111R  .
;
proc sql;
create table want as
select a.id,b.blk
from have a left join (select * from have(where=(blk&amp;gt;.))) b
on find(a.id,strip(b.id))&amp;gt;0 or find(b.id,strip(a.id))&amp;gt;0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 17:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582911#M165875</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-21T17:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582913#M165877</link>
      <description>Can you have R in the text as well?&lt;BR /&gt;It's easy to do for your example data but the solution won't scale to your actual data if we don't know the remaining details.  I think you need to provide more sample data that better reflects your actual data.</description>
      <pubDate>Wed, 21 Aug 2019 17:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582913#M165877</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T17:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582914#M165878</link>
      <description>And if you add the following IDs to the table? I don't think that solution will scale to the actual data. &lt;BR /&gt;&lt;BR /&gt;BD11234&lt;BR /&gt;BD11234R2</description>
      <pubDate>Wed, 21 Aug 2019 17:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582914#M165878</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T17:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582916#M165880</link>
      <description>&lt;P&gt;True, that would deviate from the complete pattern . It's up to OP to clarify&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess in that case, COMPGED, COMPLEV, COMPARE and other fuzzy merge, REgex may be the way forward&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 17:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582916#M165880</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-21T17:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582925#M165883</link>
      <description>I think you'd need to separate the R/R1/R2/R3 portion and merge on that, but I'm waiting on OP to clarify.</description>
      <pubDate>Wed, 21 Aug 2019 18:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582925#M165883</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T18:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582992#M165909</link>
      <description>&lt;P&gt;Thank you for the codes&lt;/P&gt;&lt;P&gt;didn't quite work but I was able to mod it from there to get what I want&lt;/P&gt;&lt;P&gt;it strip the R from my id, which I need to keep, but did put the correct value for BLK.&lt;/P&gt;&lt;P&gt;thanks again&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582992#M165909</guid>
      <dc:creator>ts1993</dc:creator>
      <dc:date>2019-08-21T20:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax/code to replace an observation with its related observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582996#M165910</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286051"&gt;@ts1993&lt;/a&gt;&amp;nbsp; &amp;nbsp;I'm glad you were able to modify the code to your needs. But I am not sure or rather find that strange something in that simple piece of logic would cause a value to truncate. If you can, please do post what happened how you made the value not to truncate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In essence, the code is doing nothing besides a look up/self join&amp;nbsp; on a condition&lt;EM&gt; "exist"&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-code-to-replace-an-observation-with-its-related/m-p/582996#M165910</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-21T20:54:09Z</dc:date>
    </item>
  </channel>
</rss>

