<?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 Creating start date and end date from a single date column without ID variable in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851040#M42134</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I need to create start date and end date from a single date column: the date coulumn is as follow; &lt;STRONG&gt;date &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;03/09/2006&lt;/P&gt;&lt;P&gt;11/02/2008&lt;/P&gt;&lt;P&gt;11/04/2008&lt;/P&gt;&lt;P&gt;12/31/2010&lt;/P&gt;&lt;P&gt;09/13/2012&lt;/P&gt;&lt;P&gt;02/24/2014&lt;/P&gt;&lt;P&gt;From this date, I need to create two columns; start date and end date, no ID variable in this data. Thank you.&lt;/P&gt;</description>
    <pubDate>Sat, 24 Dec 2022 23:23:41 GMT</pubDate>
    <dc:creator>bioresearch</dc:creator>
    <dc:date>2022-12-24T23:23:41Z</dc:date>
    <item>
      <title>Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851040#M42134</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I need to create start date and end date from a single date column: the date coulumn is as follow; &lt;STRONG&gt;date &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;03/09/2006&lt;/P&gt;&lt;P&gt;11/02/2008&lt;/P&gt;&lt;P&gt;11/04/2008&lt;/P&gt;&lt;P&gt;12/31/2010&lt;/P&gt;&lt;P&gt;09/13/2012&lt;/P&gt;&lt;P&gt;02/24/2014&lt;/P&gt;&lt;P&gt;From this date, I need to create two columns; start date and end date, no ID variable in this data. Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2022 23:23:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851040#M42134</guid>
      <dc:creator>bioresearch</dc:creator>
      <dc:date>2022-12-24T23:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851041#M42135</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have;
var date;
output out=minmax min=startdate max=enddate;
run;
data want;
if _n_=1 then set minmax;
set have;
format startdate enddate mmddyy10. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Dec 2022 23:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851041#M42135</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-24T23:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851043#M42136</link>
      <description>&lt;P&gt;If you prefer an SQL solution:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table Want as
  select *
         ,min(date) as Date_Min format = mmddyy10.
         ,max(date) as Date_Max format = mmddyy10.          
  from Have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Dec 2022 23:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851043#M42136</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-12-24T23:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851045#M42137</link>
      <description>&lt;P&gt;Thanks for the responses. However, the result that I want is to use every first date as the start date and the the next date minus a month as end date so that the next date will be the next start date. For example&lt;/P&gt;&lt;P&gt;date&lt;/P&gt;&lt;P&gt;03/09/2006&lt;/P&gt;&lt;P&gt;11/02/2008&lt;/P&gt;&lt;P&gt;11/04/2008&lt;/P&gt;&lt;P&gt;12/31/2010&lt;/P&gt;&lt;P&gt;09/13/2012&lt;/P&gt;&lt;P&gt;02/24/2014&lt;/P&gt;&lt;P&gt;the first start date is 03/09/2006 and end date is 10/31/2008&lt;/P&gt;&lt;P&gt;the second start date is 11/02/2008 and end date is 11/03/2008&lt;/P&gt;&lt;P&gt;the third start date is 11/02/2008 and end date is 11/30/2010&lt;/P&gt;&lt;P&gt;and so on.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Sun, 25 Dec 2022 00:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851045#M42137</guid>
      <dc:creator>bioresearch</dc:creator>
      <dc:date>2022-12-25T00:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851052#M42138</link>
      <description>&lt;P&gt;So you want N-1 observations?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have ;
  startdate=lag(date);
  if _n_ &amp;gt; 1 ;
  enddate=date-1;
  format startdate enddate yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs          date     startdate       enddate

 1     2008-11-02    2006-03-09    2008-11-01
 2     2008-11-04    2008-11-02    2008-11-03
 3     2010-12-31    2008-11-04    2010-12-30
 4     2012-09-13    2010-12-31    2012-09-12
 5     2014-02-24    2012-09-13    2014-02-23
&lt;/PRE&gt;
&lt;P&gt;If you want N observations then what do you want the extra one to look like?&lt;/P&gt;
&lt;P&gt;Perhaps it has a missing ENDDATE?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have end=eof;
  startdate=lag(date);
  if _n_ &amp;gt; 1 ;
  enddate=date-1;
  format startdate enddate yymmdd10.;
  output;
  if eof then do;
    startdate=enddate+1;
    enddate=.;
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs          date     startdate       enddate

 1     2008-11-02    2006-03-09    2008-11-01
 2     2008-11-04    2008-11-02    2008-11-03
 3     2010-12-31    2008-11-04    2010-12-30
 4     2012-09-13    2010-12-31    2012-09-12
 5     2014-02-24    2012-09-13    2014-02-23
 6     2014-02-24    2014-02-24             .

&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Dec 2022 04:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851052#M42138</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-25T04:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851160#M42139</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This solution is brilliant. Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2022 23:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/851160#M42139</guid>
      <dc:creator>bioresearch</dc:creator>
      <dc:date>2022-12-26T23:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/853580#M42240</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder why the date column is missing the first value (03/09/2006). Is there a way to adjust this? Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 21:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/853580#M42240</guid>
      <dc:creator>bioresearch</dc:creator>
      <dc:date>2023-01-12T21:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/853581#M42241</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184365"&gt;@bioresearch&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder why the date column is missing the first value (03/09/2006). Is there a way to adjust this? Thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Drop the DATE column.&amp;nbsp; You no longer need it.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 21:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/853581#M42241</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-12T21:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating start date and end date from a single date column without ID variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/853582#M42242</link>
      <description>Remove the line:&lt;BR /&gt;If _n_ &amp;gt; 1;&lt;BR /&gt;&lt;BR /&gt;Both StartDate and EndDate will be missing, but the data line will be there.</description>
      <pubDate>Thu, 12 Jan 2023 21:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-start-date-and-end-date-from-a-single-date-column/m-p/853582#M42242</guid>
      <dc:creator>djmangen</dc:creator>
      <dc:date>2023-01-12T21:59:54Z</dc:date>
    </item>
  </channel>
</rss>

