<?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: Identify the missing date in series of date with in each group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764294#M242066</link>
    <description>&lt;P&gt;On top of my previous reply (see above) ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace MISSING VALUES in TIMESERIES DATA using PROC EXPAND and PROC TIMESERIES&lt;BR /&gt;Posted 02-04-2021 10:45 AM | by gsvolba &lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Replace-MISSING-VALUES-in-TIMESERIES-DATA-using-PROC-EXPAND-and/ta-p/714806" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Replace-MISSING-VALUES-in-TIMESERIES-DATA-using-PROC-EXPAND-and/ta-p/714806&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the TIMESERIES procedure to check the continuity of your timeseries data&lt;BR /&gt;Posted 01-28-2021 03:40 PM | by gsvolba &lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Using-the-TIMESERIES-procedure-to-check-the-continuity-of-your/ta-p/714678" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Using-the-TIMESERIES-procedure-to-check-the-continuity-of-your/ta-p/714678&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Aug 2021 18:10:30 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2021-08-26T18:10:30Z</dc:date>
    <item>
      <title>Identify the missing date in series of date with in each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764287#M242061</link>
      <description>&lt;P&gt;I have a data set&amp;nbsp; with respect to dates as below.&lt;/P&gt;
&lt;P&gt;I would like to identify and insert the missing date series in each group and rest of the variables value should be previous record data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Data have:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;Employee&amp;nbsp; &amp;nbsp; var2&amp;nbsp; &amp;nbsp; var3&amp;nbsp; &amp;nbsp; var4 ..... ...&lt;/P&gt;
&lt;P&gt;01aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp; Tom&lt;/P&gt;
&lt;P&gt;02aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;
&lt;P&gt;04aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;
&lt;P&gt;05aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;
&lt;P&gt;06aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;
&lt;P&gt;01Sep2021&amp;nbsp; &amp;nbsp; &amp;nbsp; John&lt;/P&gt;
&lt;P&gt;03sep2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;John&lt;/P&gt;
&lt;P&gt;01Sep2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;John&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can see 03aug2021 is missing in under TOM and 02Sep2021 is missing from John group.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Data Want:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;Employee&amp;nbsp; &amp;nbsp; var2&amp;nbsp; &amp;nbsp; var3&amp;nbsp; &amp;nbsp; var4 ..... ...&lt;/P&gt;
&lt;P&gt;01aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp; Tom&lt;/P&gt;
&lt;P&gt;02aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;03aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;04aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;
&lt;P&gt;05aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;
&lt;P&gt;06aug2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;
&lt;P&gt;01Sep2021&amp;nbsp; &amp;nbsp; &amp;nbsp; John&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;02Sep2021&amp;nbsp; &amp;nbsp; &amp;nbsp; John&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;03sep2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;John&lt;/P&gt;
&lt;P&gt;01Sep2021&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;John&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 17:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764287#M242061</guid>
      <dc:creator>avinashns</dc:creator>
      <dc:date>2021-08-26T17:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Identify the missing date in series of date with in each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764292#M242064</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have only a minute but, if not solved by tomorrow, I can elaborate on this topic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the missing dates, my colleague&amp;nbsp;Gerhard Svolba has published numerous community library articles on this topic, using the SAS/ETS procedures PROC TIMESERIES or PROC EXPAND or PROC TIMEDATA and maybe also PROC TIMEID (??). See the Communities Library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The missing value imputation method you are looking after is called "Last Value Carry Forward" (LVCF) or "forward-filling". Search these communities with those keywords and you will find numerous hits (numerous topics on this subject).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 18:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764292#M242064</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-26T18:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Identify the missing date in series of date with in each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764294#M242066</link>
      <description>&lt;P&gt;On top of my previous reply (see above) ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace MISSING VALUES in TIMESERIES DATA using PROC EXPAND and PROC TIMESERIES&lt;BR /&gt;Posted 02-04-2021 10:45 AM | by gsvolba &lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Replace-MISSING-VALUES-in-TIMESERIES-DATA-using-PROC-EXPAND-and/ta-p/714806" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Replace-MISSING-VALUES-in-TIMESERIES-DATA-using-PROC-EXPAND-and/ta-p/714806&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the TIMESERIES procedure to check the continuity of your timeseries data&lt;BR /&gt;Posted 01-28-2021 03:40 PM | by gsvolba &lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Using-the-TIMESERIES-procedure-to-check-the-continuity-of-your/ta-p/714678" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Using-the-TIMESERIES-procedure-to-check-the-continuity-of-your/ta-p/714678&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 18:10:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764294#M242066</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-26T18:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Identify the missing date in series of date with in each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764302#M242071</link>
      <description>&lt;P&gt;You basically want to carry forward a given record over any internal "holes" in the series:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=nxt_:);
  set have (keep=employee);
  by employee;
  merge have  have (firstobs=2 keep=date rename=(date=nxt_date));
  output;
  if last.employee=0 then do while (date&amp;lt;nxt_date-1);
      date=date+1;
    output; 
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first SET statement is there just to generate the first.employee and last.employee dummies for testing in an IF statement.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 18:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764302#M242071</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-08-26T18:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Identify the missing date in series of date with in each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764305#M242074</link>
      <description>Hi,&lt;BR /&gt;Even if we are able get what are the missing dates between the max and min dates of each employee that will also be fine later we can fill other values. like &lt;BR /&gt;03aug2021      Tom   * Employee Tom missing one date&lt;BR /&gt;02Sep2021      John   * employee John missing one date&lt;BR /&gt;05Sep2021     Dave   * employee Dave missing two date&lt;BR /&gt;08Sep2021     Dave   * employee Dave missing two date ... etc &lt;BR /&gt;Thanks in advance&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Aug 2021 19:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764305#M242074</guid>
      <dc:creator>avinashns</dc:creator>
      <dc:date>2021-08-26T19:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Identify the missing date in series of date with in each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764459#M242150</link>
      <description>&lt;PRE&gt;data have;
input Date     : date9.            Employee  $;
format date date9.;
cards;
01aug2021      Tom
02aug2021      Tom
04aug2021      Tom
05aug2021      Tom
06aug2021      Tom
01Sep2021      John
03sep2021      John
04Sep2021      John
;

data want;
 merge have have(firstobs=2 keep=date employee rename=(date=_date employee=_employee));
 output;
 if employee=_employee then do;
  do date=date+1 to _date-1;
   output;
  end;
 end;
drop _:;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Aug 2021 13:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-the-missing-date-in-series-of-date-with-in-each-group/m-p/764459#M242150</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-08-27T13:32:28Z</dc:date>
    </item>
  </channel>
</rss>

