<?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: Do Loop to Make a Row for Each Date between a Start and End Date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889984#M351641</link>
    <description>Ah! It looks like this was it! It just wasn't working since I had missing values. Thank you!</description>
    <pubDate>Fri, 18 Aug 2023 20:20:09 GMT</pubDate>
    <dc:creator>klindsey</dc:creator>
    <dc:date>2023-08-18T20:20:09Z</dc:date>
    <item>
      <title>Do Loop to Make a Row for Each Date between a Start and End Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889972#M351633</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have been trying to modify my code so that I can get a row with all of the same information on each date between two dates. I have tried to research this myself, but I keep getting the error:&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing, zero,&lt;/DIV&gt;&lt;DIV class=""&gt;or invalid.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;My code currently is:&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;data have;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;set want;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;do offset=0 to intck('day', firstday, finalday);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;date= intnx('day',firstday,offset);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;output; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;format date date9.;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;drop firstday finalday;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you for your help!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 18 Aug 2023 18:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889972#M351633</guid>
      <dc:creator>klindsey</dc:creator>
      <dc:date>2023-08-18T18:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to Make a Row for Each Date between a Start and End Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889976#M351634</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
set want;
do date=firstday to finalday;
output;
end;
format date date9.;
drop firstday finalday;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2023 19:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889976#M351634</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-08-18T19:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to Make a Row for Each Date between a Start and End Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889978#M351635</link>
      <description>&lt;P&gt;The error is saying that one of your two variables is missing.&amp;nbsp; So you need to fix that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no need to use INTNX() and INTCK() when the interval you are moving by is the unit that the values are already stored in. DATE values are stored in DAYS. DATETIME and TIME values are stored in SECONDS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   set want;
   if missing(firstday) or missing(finalday) then put 'ERROR: missing dates' firstday= finalday= ;
   else do date= firstday to finalday;
     output;
   end;
   format date date9.;
   drop firstday finalday;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 19:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889978#M351635</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-18T19:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to Make a Row for Each Date between a Start and End Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889983#M351640</link>
      <description>&lt;P&gt;This was the first code I used, and I still get the same error.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 20:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889983#M351640</guid>
      <dc:creator>klindsey</dc:creator>
      <dc:date>2023-08-18T20:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to Make a Row for Each Date between a Start and End Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889984#M351641</link>
      <description>Ah! It looks like this was it! It just wasn't working since I had missing values. Thank you!</description>
      <pubDate>Fri, 18 Aug 2023 20:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Loop-to-Make-a-Row-for-Each-Date-between-a-Start-and-End-Date/m-p/889984#M351641</guid>
      <dc:creator>klindsey</dc:creator>
      <dc:date>2023-08-18T20:20:09Z</dc:date>
    </item>
  </channel>
</rss>

