<?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: How do I output dates that are not in chronological order? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867720#M342721</link>
    <description>Thank you for this. This seems to work just fine, but the records with missing dates are getting omitted totally. Any solution for that?</description>
    <pubDate>Mon, 03 Apr 2023 08:29:53 GMT</pubDate>
    <dc:creator>vidya3</dc:creator>
    <dc:date>2023-04-03T08:29:53Z</dc:date>
    <item>
      <title>How do I output dates that are not in chronological order?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867702#M342710</link>
      <description>Please help as this is very urgent.&lt;BR /&gt;&lt;BR /&gt;There are 10 visits totally, Visit 1 to Visit 10. Currently I have transported the dates from column to row form, now I need to output rows with dates that are not in chronological order. These rows contain missing dates too. Please refer to Flag column in the attachment, I have flagged the rows that need to be in the output and I don't need the rows that say 'Do not output' in the output. Thanks.&lt;BR /&gt;Version- Sas enterprise guide 7.13</description>
      <pubDate>Mon, 03 Apr 2023 06:06:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867702#M342710</guid>
      <dc:creator>vidya3</dc:creator>
      <dc:date>2023-04-03T06:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I output dates that are not in chronological order?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867703#M342711</link>
      <description>&lt;P&gt;We're working with SAS here, not with Excel &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So please post data the SAS way, as DATA step code with datalines. In many professional environments, download of Office files is prevented for security reasons, and Excel file sdo not show us the variable attributes of your real dataset(s).&lt;/P&gt;
&lt;P&gt;Instead of showing us the transposed dataset (which is much harder to work with), post the original "long" dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 07:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867703#M342711</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-03T07:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I output dates that are not in chronological order?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867706#M342715</link>
      <description>Right. Please find below sas data step.&lt;BR /&gt;(Dots indicate missing dates)&lt;BR /&gt;&lt;BR /&gt;Data have;&lt;BR /&gt;Input subject day_1 day_2 day_3 day_4 day_5 day_6 day_7 day_8 day_9 day_10;&lt;BR /&gt;Cards;&lt;BR /&gt;101 10-Jan-22 11-Jan-22 12-Jan-22 13-Jan-22 11-Jan-22 15-Jan-22 16-Jan-22 17-Jan-22 18-Jan-22 19-Jan-22&lt;BR /&gt;102 10-Jan-22 11-Jan-22 12-Jan-22 13-Jan-22 14-Jan-22 15-Jan-22 16-Jan-22 17-Jan-22 18-Jan-22 19-Jan-22&lt;BR /&gt;103 10-Jan-22 11-Jan-22 . 13-Jan-22 14-Jan-22 15-Jan-22 . 17-Jan-22 18-Jan-22 19-Jan-22&lt;BR /&gt;104 26-Jan-22 29-Jan-22 . . . . . 02-Feb-22 03-Feb-22 .&lt;BR /&gt;105 26-Jan-22 . . . . . . . . .&lt;BR /&gt;106 26-Jan-22 25-Jan-22 . . . . . 02-Feb-22 03-Feb-22 .&lt;BR /&gt;&lt;BR /&gt;Output that I'm expecting:&lt;BR /&gt;&lt;BR /&gt;Subject Day_1 Day_2 Day_3 Day_4 Day_5 Day_6 Day_7 Day_8 Day_9 Day_10 Flag&lt;BR /&gt;101 10-Jan-22 11-Jan-22 12-Jan-22 13-Jan-22 11-Jan-22 15-Jan-22 16-Jan-22 17-Jan-22 18-Jan-22 19-Jan-22 Yes&lt;BR /&gt;106 26-Jan-22 25-Jan-22 . . . . . 02-Feb-22 03-Feb-22 . Yes</description>
      <pubDate>Mon, 03 Apr 2023 07:27:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867706#M342715</guid>
      <dc:creator>vidya3</dc:creator>
      <dc:date>2023-04-03T07:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I output dates that are not in chronological order?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867708#M342716</link>
      <description>&lt;P&gt;Something like this, I suppose:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  array dates(*) date_1-date_10;
  do _N_=1 to dim(dates);
    if missing(dates(_N_)) then continue;
    if dates(_N_)&amp;lt;_date then do;
      output;
      leave;
      end;
    _date=dates(_N_);
    end;
  drop _date;
run;          &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Apr 2023 07:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867708#M342716</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2023-04-03T07:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I output dates that are not in chronological order?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867709#M342717</link>
      <description>&lt;P&gt;Please show the long dataset, and post&amp;nbsp;&lt;EM&gt;working&lt;/EM&gt; code. You need a DATALINES statement and proper informats (use the INFORMAT statement) for at least the dates.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 07:34:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867709#M342717</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-03T07:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I output dates that are not in chronological order?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867710#M342718</link>
      <description>&lt;P&gt;I take it that your original dataset contains at least three variables: subject, visit, date.&lt;/P&gt;
&lt;P&gt;Sort by subject and visit (if you have visits with missing dates, remove them here with a dataset option); then, compare date with lag(date) to see if there's an incorrect order.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 07:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867710#M342718</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-03T07:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I output dates that are not in chronological order?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867720#M342721</link>
      <description>Thank you for this. This seems to work just fine, but the records with missing dates are getting omitted totally. Any solution for that?</description>
      <pubDate>Mon, 03 Apr 2023 08:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-output-dates-that-are-not-in-chronological-order/m-p/867720#M342721</guid>
      <dc:creator>vidya3</dc:creator>
      <dc:date>2023-04-03T08:29:53Z</dc:date>
    </item>
  </channel>
</rss>

