<?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 Fill the blank with the next non blank observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313667#M68201</link>
    <description>Hello! My data looks like this:&lt;BR /&gt;Name   Col1   Col2   Col3   Col4&lt;BR /&gt;ABC     1245   7890             1290&lt;BR /&gt;XRT                 5634  2384   1276&lt;BR /&gt;UTR      6734   5689  6365   1251&lt;BR /&gt;&lt;BR /&gt;Is there a way to move the next nonmissing value to the blank space per row?&lt;BR /&gt;Also, I want the number with the first 2 digits="12" to be on col1. &lt;BR /&gt;The first row should look like this:&lt;BR /&gt;ABC 1245  1290  7890&lt;BR /&gt;&lt;BR /&gt;Any help will be greatly appreciated. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 23 Nov 2016 05:46:47 GMT</pubDate>
    <dc:creator>JT99</dc:creator>
    <dc:date>2016-11-23T05:46:47Z</dc:date>
    <item>
      <title>Fill the blank with the next non blank observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313667#M68201</link>
      <description>Hello! My data looks like this:&lt;BR /&gt;Name   Col1   Col2   Col3   Col4&lt;BR /&gt;ABC     1245   7890             1290&lt;BR /&gt;XRT                 5634  2384   1276&lt;BR /&gt;UTR      6734   5689  6365   1251&lt;BR /&gt;&lt;BR /&gt;Is there a way to move the next nonmissing value to the blank space per row?&lt;BR /&gt;Also, I want the number with the first 2 digits="12" to be on col1. &lt;BR /&gt;The first row should look like this:&lt;BR /&gt;ABC 1245  1290  7890&lt;BR /&gt;&lt;BR /&gt;Any help will be greatly appreciated. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Nov 2016 05:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313667#M68201</guid>
      <dc:creator>JT99</dc:creator>
      <dc:date>2016-11-23T05:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Fill the blank with the next non blank observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313669#M68202</link>
      <description>I notice that the data now looks different when I posted it. The blank spaces were gone. What I meant was if col3 is blank in a row,i want the value in col4 to be transferred to col3.</description>
      <pubDate>Wed, 23 Nov 2016 05:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313669#M68202</guid>
      <dc:creator>JT99</dc:creator>
      <dc:date>2016-11-23T05:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Fill the blank with the next non blank observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313696#M68206</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array cols {*} col1-col4;
do i = dim(cols) - 1 to 1 by -1;
  if cols{i} = . and cols{i+1} ne . then cols{i} = cols{i+1};
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS if col1 to colX are of type character, use ' ' instead of the dot for a missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: added "by -1" in the do statement.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 11:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313696#M68206</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-23T11:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Fill the blank with the next non blank observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313743#M68221</link>
      <description>&lt;PRE&gt;
It is numeric or character type variable ?


data have;
infile cards truncover;
input Name $ Col1 Col2 Col3 Col4;
cards;
ABC 1245 7890  . 1290
XRT 5634 2384 1276
UTR 6734 5689 6365 1251
;
run;
data want;
 set have;
 array x{*} col1-col4;
 array y{*} new1-new4;
 call sortn(of x{*});
 n=0;
 do i=1 to dim(x);
  if not missing(x{i}) then do;n+1;y{n}=x{i};end;
 end;
 drop n i col:;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Nov 2016 11:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313743#M68221</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-23T11:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Fill the blank with the next non blank observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313970#M68312</link>
      <description>Thank you both!</description>
      <pubDate>Thu, 24 Nov 2016 06:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-the-blank-with-the-next-non-blank-observation/m-p/313970#M68312</guid>
      <dc:creator>JT99</dc:creator>
      <dc:date>2016-11-24T06:06:12Z</dc:date>
    </item>
  </channel>
</rss>

