<?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: &amp;quot;Draging&amp;quot; data from one row to following rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/quot-Draging-quot-data-from-one-row-to-following-rows/m-p/918423#M361762</link>
    <description>&lt;P&gt;works great, thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 29 Feb 2024 15:02:55 GMT</pubDate>
    <dc:creator>Taliah</dc:creator>
    <dc:date>2024-02-29T15:02:55Z</dc:date>
    <item>
      <title>"Draging" data from one row to following rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Draging-quot-data-from-one-row-to-following-rows/m-p/918408#M361760</link>
      <description>&lt;P&gt;Hello, I have a data set like:&lt;/P&gt;
&lt;P&gt;A&amp;nbsp; B&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;11&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; 12&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; 13&lt;/P&gt;
&lt;P&gt;4&amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;5&amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;6&amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;7&amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;The goal is to have SAS search for all locations of b=0 and enter instead the lag of b, draging it throughout all "0"s, to get&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; 11&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; 12&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; 13&lt;/P&gt;
&lt;P&gt;4&amp;nbsp; 13&lt;/P&gt;
&lt;P&gt;5&amp;nbsp; 13&lt;/P&gt;
&lt;P&gt;6&amp;nbsp; 13&lt;/P&gt;
&lt;P&gt;7&amp;nbsp; 13&lt;/P&gt;
&lt;P&gt;I'm using the code&lt;/P&gt;
&lt;P&gt;data test1;&lt;/P&gt;
&lt;P&gt;set test;&lt;/P&gt;
&lt;P&gt;x=lag(b);&lt;/P&gt;
&lt;P&gt;if b=0 then b=x;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;Only b in line 4 gets to be 13, not the following rows, in them b stays 0.&lt;/P&gt;
&lt;P&gt;Any help will be appriciated. This data set is an example, we do not know how many row there are with b&amp;gt;0 and how many with b=0, those rows can be at the end but also in other placed in the data set.&amp;nbsp;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 14:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Draging-quot-data-from-one-row-to-following-rows/m-p/918408#M361760</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2024-02-29T14:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: "Draging" data from one row to following rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Draging-quot-data-from-one-row-to-following-rows/m-p/918421#M361761</link>
      <description>&lt;P&gt;It's simpler to create a new variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   retain C;
   if b ne 0 then c=b;
   drop b;
   rename c=b;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;C contains the proper values.&amp;nbsp; So the DROP statement gets rid of the original variable B.&amp;nbsp; And the RENAME statement changes the variable name from C (with proper values) to B (which is no longer being used).&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 14:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Draging-quot-data-from-one-row-to-following-rows/m-p/918421#M361761</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-02-29T14:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: "Draging" data from one row to following rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Draging-quot-data-from-one-row-to-following-rows/m-p/918423#M361762</link>
      <description>&lt;P&gt;works great, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 15:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Draging-quot-data-from-one-row-to-following-rows/m-p/918423#M361762</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2024-02-29T15:02:55Z</dc:date>
    </item>
  </channel>
</rss>

