<?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: Calculating missing values using data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316336#M69106</link>
    <description>&lt;P&gt;But proc reg will use ALL the non-missing values to make estimates.&amp;nbsp; I think the OP just wants to use the nearest non-missing value on each end of the missing sequence.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Dec 2016 18:18:32 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2016-12-02T18:18:32Z</dc:date>
    <item>
      <title>Calculating missing values using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316318#M69094</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;My data looks like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one;&lt;BR /&gt;infile datalines missover;&lt;BR /&gt;input column_1 column_2 column_3 column_4 column_5 column_6 column_7 column_8 column_9 column_10 column_11 column_12 column_13 column_14 column_15 column_16 $ Start;&lt;/P&gt;&lt;P&gt;datalines;&lt;BR /&gt;. . . . . . . . . 52.5 . . . . . 68.10 10&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to interpolate values for columns column_11 to column_15 (the missing values between column_10 and column_16) based on formula&lt;/P&gt;&lt;P&gt;column_11 = column_10 +&amp;nbsp;(((Column_16 - Column_10)/(16-10))*(11-10));&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Start denotes the column_name from which the interpolation(filling of missing values) should start. It will always have a value like column_16.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 17:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316318#M69094</guid>
      <dc:creator>akhilesh_joshi</dc:creator>
      <dc:date>2016-12-02T17:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing values using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316322#M69096</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set one;
   array c {11:15} column_11-Column_15;

   do i = 11 to 15;
      if missing c[i] then c[i] =  column_10 + (((Column_16 - Column_10)/(16-10))*( i -10)); 
   end;
   drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;perhaps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 17:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316322#M69096</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-02T17:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing values using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316328#M69102</link>
      <description>&lt;P&gt;This program will fill in all missing values, even if there are multiple sequences of missing values.&amp;nbsp; But it assumes that at least the COLUMN1 and COLUMN16 values are non-misisng.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=diff ncol c begcol endcol);

  set have;
  array col{*} column_1-column_16;

  begcol=whichn(.,of col{*});

  do while (1&amp;lt;begcol&amp;lt;dim(cols));
    /*find the last missing value in endcol*/
    do endcol=begcol to dim(col)-1 until (col{endcol+1}^=.); end;

    diff=col{endcol+1}-col{begcol-1};
    ncols=1+endcol-begcol;

    do c=1 to ncols;
      col{begcol+(c-1)} = col{begcol-1} + diff*(c/ncols);
    end;
    begcol=whichn(.,of col{*});
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 18:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316328#M69102</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-02T18:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing values using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316330#M69103</link>
      <description>&lt;P&gt;Transpose your data and use PROC REG to fill in the missing values instead. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 18:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316330#M69103</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-02T18:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing values using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316336#M69106</link>
      <description>&lt;P&gt;But proc reg will use ALL the non-missing values to make estimates.&amp;nbsp; I think the OP just wants to use the nearest non-missing value on each end of the missing sequence.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 18:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316336#M69106</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-02T18:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing values using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316338#M69107</link>
      <description>&lt;P&gt;Maybe. I suspect the exact methodology isn't that specific.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 18:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316338#M69107</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-02T18:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing values using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316384#M69122</link>
      <description>&lt;P&gt;See the &lt;A href="http://support.sas.com/kb/24/560.html" target="_self"&gt;SAS Usage Note about interpolation.&lt;/A&gt;&amp;nbsp;For a more mathematical treatment, see the article &lt;A href="http://blogs.sas.com/content/iml/2012/03/16/linear-interpolation-in-sas.html" target="_self"&gt;"Linear interpolation in SAS"&lt;/A&gt;, which also provides links to other SAS techniques.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 20:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-missing-values-using-data-step/m-p/316384#M69122</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-12-02T20:52:15Z</dc:date>
    </item>
  </channel>
</rss>

