<?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 how to replace missing value by last value in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-replace-missing-value-by-last-value/m-p/907955#M44061</link>
    <description>&lt;P&gt;When flag is equal to one how to replace missing value by 20230127 ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data test;
input flag $ date $;
datalines;
0 20250128
0 20250128
0 20250127
0 20250127
0 20250127
0 20250127
0 20250127
1 .
1 .
1 .
1 .
1 .
1 .
1 .
1 .
1 .
1 .
0 20250124
0 20250124
0 20250124
0 20250124
0 20250124
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Dec 2023 22:36:24 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2023-12-13T22:36:24Z</dc:date>
    <item>
      <title>how to replace missing value by last value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-replace-missing-value-by-last-value/m-p/907955#M44061</link>
      <description>&lt;P&gt;When flag is equal to one how to replace missing value by 20230127 ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data test;
input flag $ date $;
datalines;
0 20250128
0 20250128
0 20250127
0 20250127
0 20250127
0 20250127
0 20250127
1 .
1 .
1 .
1 .
1 .
1 .
1 .
1 .
1 .
1 .
0 20250124
0 20250124
0 20250124
0 20250124
0 20250124
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Dec 2023 22:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-replace-missing-value-by-last-value/m-p/907955#M44061</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-12-13T22:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace missing value by last value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-replace-missing-value-by-last-value/m-p/907956#M44062</link>
      <description>&lt;P&gt;To replace "by last value", which is NOT 20230127 in your example data set:&lt;/P&gt;
&lt;PRE&gt;data want;
  set test;
  length d $ 8;
  retain d;
  if not missing(date) then d=date;
  if flag='1' then date=d;
run;&lt;/PRE&gt;
&lt;P&gt;Retain keeps the value of a variable across data step boundaries. So create a new variable to hold the value with retain when assigned and then use the value as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anything called a "date" that is character is asking for all sorts of difficulty in working with.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 00:22:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-replace-missing-value-by-last-value/m-p/907956#M44062</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-12-14T00:22:54Z</dc:date>
    </item>
  </channel>
</rss>

