<?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: Dynamically replace missing character after last non missing character for each id in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dynamically-replace-missing-character-after-last-non-missing/m-p/787252#M251517</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
	update have(obs=0) have;
	by  member_id FY;
	output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Dec 2021 16:23:55 GMT</pubDate>
    <dc:creator>r_behata</dc:creator>
    <dc:date>2021-12-23T16:23:55Z</dc:date>
    <item>
      <title>Dynamically replace missing character after last non missing character for each id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamically-replace-missing-character-after-last-non-missing/m-p/787231#M251499</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to dynamically replace all missing characters after the last non missing character with the last non missing character for each member id.Example member_id 1 in FY 2018 , Qtr 4 , since comment is missing, it should be replaced with the last non missing comment which is 'abc'. For member_id 2, sine comment is missing for &amp;nbsp;FY 2018, Qtrs 3 and 4, they should be replaced by 'def' . For member_id 3, since comment is missing for FY2018, Qtrs 2,3 and4, they would be replaced with 'ghi' Could some help me out. Sample data is below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data have;
input member_id FY Qtr Comment $12.;
datalines;
1 2018 1 
1 2018 2 
1 2018 3 'abc'
1 2018 4 
2 2018 1
2 2018 2 'def'
2 2018 3 
2 2018 4
3 2018 1 'ghi'
3 2018 2 
3 2018 3
3 2018 4
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data want;
input member_id FY Qtr Comment $12.;
datalines;
1 2018 1 
1 2018 2 
1 2018 3 'abc'
1 2018 4 'abc'
2 2018 1
2 2018 2 'def'
2 2018 3 'def'
2 2018 4 'def'
3 2018 1 'ghi'
3 2018 2 'ghi'
3 2018 3 'ghi'
3 2018 4 'ghi'
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Dec 2021 12:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamically-replace-missing-character-after-last-non-missing/m-p/787231#M251499</guid>
      <dc:creator>Paakay</dc:creator>
      <dc:date>2021-12-23T12:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically replace missing character after last non missing character for each id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamically-replace-missing-character-after-last-non-missing/m-p/787234#M251502</link>
      <description>&lt;P&gt;This is a job for the RETAIN statement! If there was an official emoji for the RETAIN statement, I would insert that emoji here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    retain comment1;
    by member_id;
    if first.member_id then comment1=comment;
    if not missing(comment) then comment1=comment;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 12:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamically-replace-missing-character-after-last-non-missing/m-p/787234#M251502</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-23T12:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically replace missing character after last non missing character for each id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamically-replace-missing-character-after-last-non-missing/m-p/787252#M251517</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
	update have(obs=0) have;
	by  member_id FY;
	output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamically-replace-missing-character-after-last-non-missing/m-p/787252#M251517</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2021-12-23T16:23:55Z</dc:date>
    </item>
  </channel>
</rss>

