<?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 How to chose earliest date variable from list of date variables? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chose-earliest-date-variable-from-list-of-date-variables/m-p/416731#M67638</link>
    <description>&lt;P&gt;Dear SAS community,&lt;/P&gt;&lt;P&gt;I have list of date variables (date_x, date_y, date_z, etc.) for each Record (ID). So for each ID, I need to pick the earliest date variable from the list of all date variables and create a new date variable (date_new) using the earliest date variable for each ID. Any help with SAS code for creating this new date variable is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: I have only one row per ID with all my date variables recorded as separate variables (single row per ID).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Data Set&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Z&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_P&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Q&amp;nbsp;&amp;nbsp; Date_R&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Tue, 28 Nov 2017 15:45:46 GMT</pubDate>
    <dc:creator>sms1891</dc:creator>
    <dc:date>2017-11-28T15:45:46Z</dc:date>
    <item>
      <title>How to chose earliest date variable from list of date variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chose-earliest-date-variable-from-list-of-date-variables/m-p/416731#M67638</link>
      <description>&lt;P&gt;Dear SAS community,&lt;/P&gt;&lt;P&gt;I have list of date variables (date_x, date_y, date_z, etc.) for each Record (ID). So for each ID, I need to pick the earliest date variable from the list of all date variables and create a new date variable (date_new) using the earliest date variable for each ID. Any help with SAS code for creating this new date variable is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: I have only one row per ID with all my date variables recorded as separate variables (single row per ID).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Data Set&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Z&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_P&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Q&amp;nbsp;&amp;nbsp; Date_R&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 15:45:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-chose-earliest-date-variable-from-list-of-date-variables/m-p/416731#M67638</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2017-11-28T15:45:46Z</dc:date>
    </item>
    <item>
      <title>How to chose earliest date variable from list of date variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chose-earliest-date-variable-from-list-of-date-variables/m-p/416732#M67639</link>
      <description>&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Dear SAS community,&lt;/P&gt;&lt;P&gt;I have list of date variables (date_x, date_y, date_z, etc.) for each Record (ID). So for each ID, I need to pick the earliest date variable from the list of all date variables and create a new date variable (date_new) using the earliest date variable for each ID. Any help with SAS code for creating this new date variable is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: I have only one row per ID with all my date variables recorded as separate variables (single row per ID).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Data Set&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Z&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_P&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Q&amp;nbsp;&amp;nbsp; Date_R&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Nov 2017 15:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-chose-earliest-date-variable-from-list-of-date-variables/m-p/416732#M67639</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2017-11-28T15:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to chose earliest date variable from list of date variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chose-earliest-date-variable-from-list-of-date-variables/m-p/416734#M67640</link>
      <description>&lt;P&gt;Please do not post the same question multiple times.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the MIN() function to get the lowest date and it will ignore missing dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;min_date = min(date_x, date_y, date_z, ... , date_R);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Nov 2017 15:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-chose-earliest-date-variable-from-list-of-date-variables/m-p/416734#M67640</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-28T15:52:48Z</dc:date>
    </item>
  </channel>
</rss>

