<?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: Fill in the missing dates and assign a value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800596#M314990</link>
    <description>This code did its job. Thanks for the help!</description>
    <pubDate>Mon, 07 Mar 2022 09:58:38 GMT</pubDate>
    <dc:creator>PatrykSAS</dc:creator>
    <dc:date>2022-03-07T09:58:38Z</dc:date>
    <item>
      <title>Fill in the missing dates and assign a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800586#M314986</link>
      <description>&lt;P&gt;Hi, I have day-by-day data where some dates are missing. I would like to add missing dates to a new row and assign them a value of 0 in a separate column. There are no duplicates in the data, and they are sorted from oldest to newest. It looks like below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date :yymmdd10. count;
format date yymmddd10.;
datalines;
2022-03-02 20
2022-03-03 24
2022-03-05 23
2022-03-07 15
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input date :yymmdd10. count;
format date yymmddd10.;
datalines;
2022-03-02 20
2022-03-03 24
2022-03-04 0
2022-03-05 23
2022-03-06 0
2022-03-07 15
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you know an easy way to quickly complete such a table?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 09:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800586#M314986</guid>
      <dc:creator>PatrykSAS</dc:creator>
      <dc:date>2022-03-07T09:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in the missing dates and assign a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800593#M314987</link>
      <description>&lt;P&gt;Do you have SAS/ETS?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 09:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800593#M314987</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-03-07T09:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in the missing dates and assign a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800594#M314988</link>
      <description>&lt;P&gt;If so then Proc Timeseries is the right tool&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date :yymmdd10. count;
format date yymmddd10.;
datalines;
2022-03-02 20
2022-03-03 24
2022-03-05 23
2022-03-07 15
;
run;

proc timeseries data = have out = want;
   id date interval   = day
           accumulate = none
           setmiss    = 0
           format     = yymmddd10.;
   var count;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Result:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;date        count 
2022-03-02  20 
2022-03-03  24 
2022-03-04  0 
2022-03-05  23 
2022-03-06  0 
2022-03-07  15 &amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 09:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800594#M314988</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-03-07T09:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in the missing dates and assign a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800596#M314990</link>
      <description>This code did its job. Thanks for the help!</description>
      <pubDate>Mon, 07 Mar 2022 09:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800596#M314990</guid>
      <dc:creator>PatrykSAS</dc:creator>
      <dc:date>2022-03-07T09:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in the missing dates and assign a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800599#M314992</link>
      <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 10:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800599#M314992</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-03-07T10:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in the missing dates and assign a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800837#M315104</link>
      <description>&lt;PRE&gt;data have;
input date :yymmdd10. count;
format date yymmddd10.;
datalines;
2022-03-02 20
2022-03-03 24
2022-03-05 23
2022-03-07 15
;
run;

data want;
merge have have(keep=date rename=(date=_date) firstobs=2);
output;
do date=date+1 to coalesce(_date-1,0);
 count=0;output;
end;
drop _date;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Mar 2022 12:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fill-in-the-missing-dates-and-assign-a-value/m-p/800837#M315104</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-03-08T12:15:02Z</dc:date>
    </item>
  </channel>
</rss>

