<?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: Replacing null with previous values . in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replacing-null-with-previous-values/m-p/623396#M183529</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/121190"&gt;@MG18&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the retain statement to create a temporary variable as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm=" " dsd missover;
	input Month $ Emp_name $ Salary;
	datalines;
Jan Aaaa 100
Jan Bbbb 200
Jan  200
Jan  400
Jan Dddd 400
;
run;

data want;
	set have;
	retain _Emp_name;
	if not missing(Emp_name) then _Emp_name = Emp_name;
	else Emp_name = _Emp_name;
	drop _Emp_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 09 Feb 2020 09:26:11 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-02-09T09:26:11Z</dc:date>
    <item>
      <title>Replacing null with previous values .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-null-with-previous-values/m-p/623392#M183527</link>
      <description>&lt;P&gt;In a table 3 variables are there&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Month&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Emp_name&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Salary&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Aaaa&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;100&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Bbbb&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;200&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;200&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;400&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Dddd&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;400&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to replace missing Emp_name with the previous latest Emp_name? Means 4th&amp;nbsp;and 5th&amp;nbsp;record of Emp_Name should be replace with ‘bbbb’ ?&lt;/P&gt;</description>
      <pubDate>Sun, 09 Feb 2020 09:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-null-with-previous-values/m-p/623392#M183527</guid>
      <dc:creator>MG18</dc:creator>
      <dc:date>2020-02-09T09:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing null with previous values .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-null-with-previous-values/m-p/623396#M183529</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/121190"&gt;@MG18&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the retain statement to create a temporary variable as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm=" " dsd missover;
	input Month $ Emp_name $ Salary;
	datalines;
Jan Aaaa 100
Jan Bbbb 200
Jan  200
Jan  400
Jan Dddd 400
;
run;

data want;
	set have;
	retain _Emp_name;
	if not missing(Emp_name) then _Emp_name = Emp_name;
	else Emp_name = _Emp_name;
	drop _Emp_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 09 Feb 2020 09:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-null-with-previous-values/m-p/623396#M183529</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-09T09:26:11Z</dc:date>
    </item>
  </channel>
</rss>

