<?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: Intck and arrays in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788790#M32377</link>
    <description>&lt;P&gt;Why is 1 repeated for two different dates for the same subject?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381504"&gt;@ppl&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a longitudinal dataset, where subjects are followed up for 2 weeks. An observation is recorded daily. The subjects each have a start and end date that is different. There are some missing values in there too. Data set example:&lt;/P&gt;
&lt;P&gt;Subject_ID&amp;nbsp; &amp;nbsp;Date&amp;nbsp; &amp;nbsp; Obs&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01/02/21&amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/03/21&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/06/21&amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/07/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/05/21&amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/06/21&amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I add a column for the day order (i.e. day1, day2.....day14) which includes a missing values e.g. subject 10 is missing 01/04/21 and the rest upto two weeks.&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;&lt;BR /&gt;I suspect your question is related to this persons?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-a-variable-indicating-day-number-per-person/m-p/788358#M252039" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Creating-a-variable-indicating-day-number-per-person/m-p/788358#M252039&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jan 2022 03:59:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-01-07T03:59:51Z</dc:date>
    <item>
      <title>Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788766#M32375</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a longitudinal dataset, where subjects are followed up for 2 weeks. An observation is recorded daily. The subjects each have a start and end date that is different. There are some missing values in there too. Data set example:&lt;/P&gt;&lt;P&gt;Subject_ID&amp;nbsp; &amp;nbsp;Date&amp;nbsp; &amp;nbsp; Obs&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01/02/21&amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/03/21&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/06/21&amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/07/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/05/21&amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/06/21&amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I add a column for the day order (i.e. day1, day2.....day14) which includes a missing values e.g. subject 10 is missing 01/04/21 and the rest upto two weeks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 01:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788766#M32375</guid>
      <dc:creator>ppl</dc:creator>
      <dc:date>2022-01-07T01:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788774#M32376</link>
      <description>&lt;P&gt;Your have data is monthly but in your narrative you're talking about two week periods.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please post the desired result based on the sample data you've shared? That should reduce most of the ambiguity.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 02:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788774#M32376</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-01-07T02:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788790#M32377</link>
      <description>&lt;P&gt;Why is 1 repeated for two different dates for the same subject?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381504"&gt;@ppl&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a longitudinal dataset, where subjects are followed up for 2 weeks. An observation is recorded daily. The subjects each have a start and end date that is different. There are some missing values in there too. Data set example:&lt;/P&gt;
&lt;P&gt;Subject_ID&amp;nbsp; &amp;nbsp;Date&amp;nbsp; &amp;nbsp; Obs&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01/02/21&amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/03/21&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/06/21&amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/07/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/05/21&amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/06/21&amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I add a column for the day order (i.e. day1, day2.....day14) which includes a missing values e.g. subject 10 is missing 01/04/21 and the rest upto two weeks.&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;&lt;BR /&gt;I suspect your question is related to this persons?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-a-variable-indicating-day-number-per-person/m-p/788358#M252039" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Creating-a-variable-indicating-day-number-per-person/m-p/788358#M252039&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 03:59:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788790#M32377</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-01-07T03:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788811#M32378</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381504"&gt;@ppl&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a longitudinal dataset, where subjects are followed up for 2 weeks. &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;An observation is recorded daily.&lt;/FONT&gt;&lt;/STRONG&gt; The subjects each have a start and end date that is different. &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;There are some missing values in there too&lt;/FONT&gt;.&lt;/STRONG&gt; Data set example:&lt;/P&gt;
&lt;P&gt;Subject_ID&amp;nbsp; &amp;nbsp;Date&amp;nbsp; &amp;nbsp; Obs&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01/02/21&amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/03/21&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/06/21&amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/07/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/05/21&amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/06/21&amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;How do I add a column for the day order (i.e. day1, day2.....day14) which includes a missing values e.g. subject 10 is missing 01/04/21 and the rest upto two weeks.&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&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;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;An observation is recorded daily.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The obs you have posted seem to be monthly, or are the dates in the obscure month-day-year format? Posting data as working data step always helps to avoid such confusion. Also add an explanation for the variable "obs" it is not clear whether it is just additional information in the data or should be used to solve the task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;There are some missing values in there too&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You don't have a single missing value in the data you have posted, maybe obs are missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;How do I add a column for the day order (i.e. day1, day2.....day14) which includes a missing values e.g. subject 10 is missing 01/04/21 and the rest upto two weeks.&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Not clear what want actually. Please add a table showing the expected results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After some mind-wrangling this may or may not be want you expect:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   by Subject_ID;
   
   retain expected_date first_date day;
   
   if first.Subject_Id then do;
      day = 1;
      expected_date = date;
      first_date = date;
   end;
   else do;
      day = day + 1;
   end;
   
   if expected_date = date then do;
      output;
   end;
   else do;
      do i = 0 to date - expected_date;
         date = expected_date + i;
         day = day + i;
         output;
      end;
   end;
   
   if last.Subject_Id then do;
      d = 14 - intck('day', first_date, date) - 1;
      
      if d &amp;gt; 0 then do i = 1 to d;
         date = date + 1;
         day = day + 1;
         output;
      end;
   end;

   expected_date = date + 1;
   
   drop i d expected_date first_date ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jan 2022 08:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788811#M32378</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-01-07T08:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788812#M32379</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381504"&gt;@ppl&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I assume that you have a table (work.intervals) with the start and end days per subject, e.g. with the following three columns:&lt;/P&gt;&lt;P&gt;Subject_ID&amp;nbsp; &amp;nbsp;Start_Date&amp;nbsp; &amp;nbsp;Enddate&lt;/P&gt;&lt;P&gt;You could create a new table (work.day_order) for the day order (i.e. day1, day2.....day14) per subject with the following three columns via a DO loop in a data step&lt;/P&gt;&lt;P&gt;Subject_ID&amp;nbsp;&amp;nbsp; Day_order&amp;nbsp; &amp;nbsp;Date&lt;/P&gt;&lt;P&gt;Then you could merge the day order table with your observation table (work.observations) via the column “Date”.&lt;/P&gt;&lt;P&gt;But that is just one of several possibilites.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 08:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788812#M32379</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-01-07T08:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788815#M32380</link>
      <description>&lt;P&gt;A result like this&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Subject_ID&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;date&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;day_order&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Obs&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/02/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Day 1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/03/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Day 2&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/04/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Day 3&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/05/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Day 4&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/06/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Day 5&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/07/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Day 6&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/08/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Day 7&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/09/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Day 8&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can be produced with the following code (I created the input data in excel):&lt;/P&gt;&lt;P&gt;libname Intval xlsx "/home/u59608141/sasuser.v94/Intervals.xlsx";&lt;/P&gt;&lt;P&gt;libname Observat xlsx "/home/u59608141/sasuser.v94/Observations.xlsx";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data day_order;&lt;/P&gt;&lt;P&gt;set intval.Tabelle1;&lt;/P&gt;&lt;P&gt;date=start_date-1;&lt;/P&gt;&lt;P&gt;Do i=1 to 14;&lt;/P&gt;&lt;P&gt;day_order = cat("Day ",i);&lt;/P&gt;&lt;P&gt;date=date+1;&lt;/P&gt;&lt;P&gt;Format date MMDDYY10.;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;keep Subject_ID day_order date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Observat;&lt;/P&gt;&lt;P&gt;set Observat.Observations;&lt;/P&gt;&lt;P&gt;Datenum=input(Date,MMDDYY8.);&lt;/P&gt;&lt;P&gt;drop date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data result;&lt;/P&gt;&lt;P&gt;merge day_order observat (rename=(datenum=date));&lt;/P&gt;&lt;P&gt;by Subject_ID date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc print data=result noobs;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 09:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788815#M32380</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-01-07T09:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788824#M32381</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Subject_ID   Date   : mmddyy10. Obs;
format Date  mmddyy10.;
cards;
10       01/02/21    1
10      01/03/21     1
10      01/05/21     2
11      02/05/21     4
11      02/06/21     3
11      02/07/21     2
12      03/05/21    1
12      03/06/21    5
;
 
data want;
merge have have(keep=Subject_ID   Date rename=(Subject_ID=_Subject_ID   Date=_Date) firstobs=2);
output;
if Subject_ID=_Subject_ID then do;
do date=date+1 to _date-1;
  obs=.;output;
end;
end;
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jan 2022 11:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788824#M32381</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-07T11:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788853#M32382</link>
      <description>&lt;P&gt;Thanks, I think this is almost what is expected. For those asking why I have data for different months, the data was collected over several months, but all subjects have data for 2 weeks only. It is not practical to have all subjects have the same start date. Some will be recruited this month, others next month and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding the date format it was meant to be in mmddyy10. format. I also meant to say Var instead of obs.&lt;/P&gt;&lt;P&gt;There is a lot of missing data in the table as the observations are meant to be taken daily for two weeks only.&lt;/P&gt;&lt;P&gt;Expected table:&lt;/P&gt;&lt;P&gt;Subject_ID&amp;nbsp; &amp;nbsp;Date&amp;nbsp; &amp;nbsp; Obs&amp;nbsp; &amp;nbsp; Day&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01/02/21&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;Day1&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/03/21&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; Day2&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/04/21&amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; &amp;nbsp; Day 3&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; Day 4&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp;01/06/21&amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Day 5&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp;01/07/21&amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp; Day 6&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp;01/08/21&amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp; Day 7&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp;01/09/21&amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp;Day 8&lt;/P&gt;&lt;P&gt;etc&amp;nbsp; &amp;nbsp; upto Day 14&amp;nbsp;&lt;/P&gt;&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/05/21&amp;nbsp; &amp;nbsp; &amp;nbsp;4&amp;nbsp; &amp;nbsp; Day1&lt;/P&gt;&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/06/21&amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; Day2&lt;/P&gt;&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; 02/07/21&amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; Day3&lt;/P&gt;&lt;P&gt;etc upto Day 14&lt;/P&gt;&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/05/21&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; Day 1&lt;/P&gt;&lt;P&gt;12&amp;nbsp; &amp;nbsp; &amp;nbsp; 03/06/21&amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp;Day 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 13:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788853#M32382</guid>
      <dc:creator>ppl</dc:creator>
      <dc:date>2022-01-07T13:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788854#M32383</link>
      <description>&lt;P&gt;Thanks for your response. Unfortunately, I do not have a start or end date column. Just dates arranged in chronological order with a variable collected at that date.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 13:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788854#M32383</guid>
      <dc:creator>ppl</dc:creator>
      <dc:date>2022-01-07T13:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788856#M32384</link>
      <description>&lt;P&gt;I just noticed, that you don't need an enddate, if you assume that the intervall is always 14 days.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 13:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788856#M32384</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-01-07T13:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788857#M32385</link>
      <description>&lt;P&gt;For the start date you might use the first. Column as above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 13:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788857#M32385</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-01-07T13:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788860#M32386</link>
      <description>&lt;P&gt;So you want to insure that each subject has at least 14 days/observations?&lt;/P&gt;
&lt;P&gt;You need to know the first/last day that was actually collected. Or the first expected day if it is possible the first day is missing.&amp;nbsp; For now let's just compute that from your existing dataset.&lt;/P&gt;
&lt;P&gt;So first let's convert your listing into an actual SAS dataset so we have something to test our program against.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input Subject_ID  Date :yymmdd. Var1 ;
  format date yymmdd10.;
cards;
10 2021-01-02 1
10 2021-01-03 1
10 2021-01-05 2
11 2021-02-05 4
11 2021-02-06 3
11 2021-02-07 2
12 2021-03-05 1
12 2021-03-06 5 
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note: To avoid confusing half of your audience do not display dates in either MDY or DMY order. Use YMD order or the DATE9. format instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now calculate the min/max date per subject and then generate a dataset with all of the observations for each subject. Then combine it with your actual data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have;
  by subject_id;
  var date;
  output out=skeleton min=start max=end;
run;

data skeleton;
  set skeleton;
  end=max(end,start+13);
  do date=start to end;
    day=date-start+1;
    output;
  end;
  format date yymmdd10.;
  keep subject_id date day ;
run;

data want;
  merge skeleton have;
  by subject_id date;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;      Subject_
Obs       ID             date    day    Var1

  1       10       2021-01-02      1      1
  2       10       2021-01-03      2      1
  3       10       2021-01-04      3      .
  4       10       2021-01-05      4      2
  5       10       2021-01-06      5      .
  6       10       2021-01-07      6      .
  7       10       2021-01-08      7      .
  8       10       2021-01-09      8      .
  9       10       2021-01-10      9      .
 10       10       2021-01-11     10      .
 11       10       2021-01-12     11      .
 12       10       2021-01-13     12      .
 13       10       2021-01-14     13      .
 14       10       2021-01-15     14      .
 15       11       2021-02-05      1      4
 16       11       2021-02-06      2      3
 17       11       2021-02-07      3      2
 18       11       2021-02-08      4      .
 19       11       2021-02-09      5      .
 20       11       2021-02-10      6      .
 21       11       2021-02-11      7      .
 22       11       2021-02-12      8      .
 23       11       2021-02-13      9      .
 24       11       2021-02-14     10      .
 25       11       2021-02-15     11      .
 26       11       2021-02-16     12      .
 27       11       2021-02-17     13      .
 28       11       2021-02-18     14      .
 29       12       2021-03-05      1      1
 30       12       2021-03-06      2      5
 31       12       2021-03-07      3      .
 32       12       2021-03-08      4      .
 33       12       2021-03-09      5      .
 34       12       2021-03-10      6      .
...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 13:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788860#M32386</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-07T13:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Intck and arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788902#M32387</link>
      <description>&lt;P&gt;Thank you so much. Appreciate your help in teaching me this one.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 15:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Intck-and-arrays/m-p/788902#M32387</guid>
      <dc:creator>ppl</dc:creator>
      <dc:date>2022-01-07T15:58:34Z</dc:date>
    </item>
  </channel>
</rss>

