<?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: How to populate random missing  values in a table withaverage of its preceeding and following va in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-populate-random-missing-values-in-a-table-withaverage-of/m-p/346393#M79878</link>
    <description>&lt;PRE&gt;
What if there are multiple series missing value ,what you gonna do ?



data have;
input Accno MOnth $ Bal;
cards;
1         oct16   100
2         sep16   .
3.        aug16   50
;
run;
data want;
 merge have have(keep=bal firstobs=2 rename=(bal=_bal));
 lag=lag(bal);
 if missing(bal) then bal=mean(lag,_bal);
 drop _bal lag;
run;


&lt;/PRE&gt;</description>
    <pubDate>Sat, 01 Apr 2017 12:48:17 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-04-01T12:48:17Z</dc:date>
    <item>
      <title>How to populate random missing  values in a table withaverage of its preceeding and following values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-populate-random-missing-values-in-a-table-withaverage-of/m-p/346389#M79874</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a table with say 3 columns 1.Accno 2.month 3.Bal&lt;/P&gt;&lt;P&gt;What is required :&lt;/P&gt;&lt;P&gt;In this table i have records for each account where balance is missing for random months.(no of months considered : 24only)&lt;/P&gt;&lt;P&gt;What i needed is, to take the immediate next available balance , immediate preceeding available balance wrt the missing bal record, take an average of these values and populate this avg in place of the missing bal record.&lt;/P&gt;&lt;P&gt;table format :&lt;/P&gt;&lt;P&gt;Accno MOnth Bal&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oct16&amp;nbsp;&amp;nbsp; 100&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sep16&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aug16&amp;nbsp;&amp;nbsp; 50&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, sep16 has a missing bal. so, avg(oct16 bal ,aug16) is 2 be populated in sep16 record.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thankx in advance for any help!.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2017 12:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-populate-random-missing-values-in-a-table-withaverage-of/m-p/346389#M79874</guid>
      <dc:creator>kk5</dc:creator>
      <dc:date>2017-04-01T12:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate random missing  values in a table withaverage of its preceeding and following va</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-populate-random-missing-values-in-a-table-withaverage-of/m-p/346393#M79878</link>
      <description>&lt;PRE&gt;
What if there are multiple series missing value ,what you gonna do ?



data have;
input Accno MOnth $ Bal;
cards;
1         oct16   100
2         sep16   .
3.        aug16   50
;
run;
data want;
 merge have have(keep=bal firstobs=2 rename=(bal=_bal));
 lag=lag(bal);
 if missing(bal) then bal=mean(lag,_bal);
 drop _bal lag;
run;


&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Apr 2017 12:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-populate-random-missing-values-in-a-table-withaverage-of/m-p/346393#M79878</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-01T12:48:17Z</dc:date>
    </item>
  </channel>
</rss>

