<?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: UPDATE statement - Fill null values with previous non-null values within same group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619395#M181840</link>
    <description>&lt;P&gt;Just re-read those variables from the dataset.&lt;/P&gt;
&lt;P&gt;Let's day you want to update only VAR1-VAR5 .&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
   update MyData(obs=0) MyData ;
   by ID;
   set MyData (drop=Var1-Var5);
   output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Jan 2020 01:59:57 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-01-23T01:59:57Z</dc:date>
    <item>
      <title>UPDATE statement - Fill null values with previous non-null values within same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619394#M181839</link>
      <description>&lt;P&gt;I've been looking for a way to fill null values with previous non-null values within the same group.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While I know how to do that in SQL it took me a while to figure out in SAS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been able to figure out the code that will accomplish this. However, I'd like this to apply to only about 10 variables of about 100 variables I have in my data set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a way to apply the update to only selected variables with the below code?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
   update MyData(obs=0) MyData;
   by ID;
   output;
run;
 
proc print data=Want;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance !&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 01:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619394#M181839</guid>
      <dc:creator>renanm</dc:creator>
      <dc:date>2020-01-23T01:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE statement - Fill null values with previous non-null values within same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619395#M181840</link>
      <description>&lt;P&gt;Just re-read those variables from the dataset.&lt;/P&gt;
&lt;P&gt;Let's day you want to update only VAR1-VAR5 .&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
   update MyData(obs=0) MyData ;
   by ID;
   set MyData (drop=Var1-Var5);
   output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 01:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619395#M181840</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-23T01:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE statement - Fill null values with previous non-null values within same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619489#M181899</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;, thanks for the reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your suggestion below, wouldn't the output data only contain VAR1-VAR5?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ultimately I need the output dataset to contain all 100 variables VAR1-VAR100 but only retro-fill VAR1-VAR5.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 13:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619489#M181899</guid>
      <dc:creator>renanm</dc:creator>
      <dc:date>2020-01-23T13:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE statement - Fill null values with previous non-null values within same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619517#M181914</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/129176"&gt;@renanm&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;, thanks for the reply.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your suggestion below, wouldn't the output data only contain VAR1-VAR5?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ultimately I need the output dataset to contain all 100 variables VAR1-VAR100 but only retro-fill VAR1-VAR5.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks !&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No. Try it.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 14:16:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UPDATE-statement-Fill-null-values-with-previous-non-null-values/m-p/619517#M181914</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-23T14:16:34Z</dc:date>
    </item>
  </channel>
</rss>

