<?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 Weirder birthdate question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601527#M174001</link>
    <description>My birth date data is coded as two variables in the data set: birthmonth and birthyear. I'm struggling to combine these into a format that I can then subtract from the date the interviews were completed.&lt;BR /&gt;&lt;BR /&gt;How would you suggest combining birthmonth and birthyear into birth date?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you!!!</description>
    <pubDate>Mon, 04 Nov 2019 22:43:31 GMT</pubDate>
    <dc:creator>klongway</dc:creator>
    <dc:date>2019-11-04T22:43:31Z</dc:date>
    <item>
      <title>Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601527#M174001</link>
      <description>My birth date data is coded as two variables in the data set: birthmonth and birthyear. I'm struggling to combine these into a format that I can then subtract from the date the interviews were completed.&lt;BR /&gt;&lt;BR /&gt;How would you suggest combining birthmonth and birthyear into birth date?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you!!!</description>
      <pubDate>Mon, 04 Nov 2019 22:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601527#M174001</guid>
      <dc:creator>klongway</dc:creator>
      <dc:date>2019-11-04T22:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601530#M174003</link>
      <description>Use the MDY() function to create a date.&lt;BR /&gt;&lt;BR /&gt;Birth_Date = MDY(birthmonth, 15, birthyear);&lt;BR /&gt;&lt;BR /&gt;Duration = interview_date - birth_date;</description>
      <pubDate>Mon, 04 Nov 2019 23:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601530#M174003</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-04T23:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601532#M174004</link>
      <description>&lt;P&gt;What are these two fields (birthmonth and birthyear) stored as? January and 1990? Are they strings?&lt;/P&gt;
&lt;P&gt;You really need to help yourself by providing all the information when asking a question.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 23:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601532#M174004</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-11-04T23:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601536#M174006</link>
      <description>When I do your solution Reeza I end up with numbers in the birth date column.&lt;BR /&gt;&lt;BR /&gt;So for participant 45, their birthdate is January 1978. When I use birth_date=MDY (birthmonth, 15, birthyear) I end up with a birthdate of 6589.&lt;BR /&gt;&lt;BR /&gt;I'm sure its something simple I'm missing.</description>
      <pubDate>Mon, 04 Nov 2019 23:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601536#M174006</guid>
      <dc:creator>klongway</dc:creator>
      <dc:date>2019-11-04T23:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601537#M174007</link>
      <description>&lt;P&gt;&lt;SPAN&gt;"January 1978" is not an exact date.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;used 15 as the day of the month in the mdy() function to create such an exact date.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The mdy() function creates a SAS date value which is the count of days since 1/1/1960. To print such a count in a human readable form apply a format to the variable like:&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;format&amp;nbsp;Birth_Date&amp;nbsp;date9.;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 23:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601537#M174007</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-04T23:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601540#M174008</link>
      <description>SAS dates are stored as numbers from the date of January 1 1960. All systems typically store dates in this fashion and then apply a format to show them displayed.&lt;BR /&gt;&lt;BR /&gt;Add the following line to have them show as a SAS date. &lt;BR /&gt;&lt;BR /&gt;format birth_date date9.;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Nov 2019 00:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601540#M174008</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-05T00:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601543#M174009</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/106227"&gt;@klongway&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;Nothing is missing, really. SAS date is the number of days since the beginning of 1960, which is 6589 for 1978-01-15. Since the SAS date is merely a number, SAS prints it by default using the BEST12. format, and so it is displayed as 6589. If you want to see it as a formatted date, you need to apply one of (a great variety of) date formats to your birth_date variable. &amp;nbsp;For example, run this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;                                                                                                                           
  retain birthmonth 1 birthday 15 birthyear 1978 ;                                                                                      
  birth_date = MDY (birthmonth, birthday, birthyear) ;                                                                                           
  put birth_date=best12. birth_date=yymmdd10. ;                                                                                                             
run ;  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result in the SAS log:&lt;/P&gt;
&lt;PRE&gt;birth_date=6589 birth_date=1978-01-15 
&lt;/PRE&gt;
&lt;P&gt;If you're creating a data set with the birth_date variable and want it to appear formatted in a viewer or other kind of output medium, assign the format to the variable:&lt;/P&gt;
&lt;PRE&gt;data want ;                                                                                                                             
  retain birthmonth 1 birthday 15 birthyear 1978 ;                                                                                      
  birth_date = MDY (birthmonth, birthday, birthyear) ;                                                                                  
  &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;format birth_date yymmdd10. ;&lt;/STRONG&gt;&lt;/FONT&gt;                                                                                                         
run ; 
&lt;/PRE&gt;
&lt;P&gt;I strongly recommend that a format where year, month, day are listed in this sequence be used, without exception, to preserve sanity when browsing data sorted by date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 00:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601543#M174009</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-11-05T00:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601586#M174028</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/21262"&gt;@hashman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I strongly recommend that a format where year, month, day are listed in this sequence be used, without exception, to preserve sanity when browsing data sorted by date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Absolutely concur with this. There is an international standard for writing out dates and times (ISO 8601), and the SAS formats YYMMDDD10. and E8601DA10. both display a date according to this standard, in a nice human-readable way.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 07:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601586#M174028</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-05T07:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Weirder birthdate question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601587#M174029</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; to preserve sanity&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I couldn't agree more.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 07:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Weirder-birthdate-question/m-p/601587#M174029</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-11-05T07:46:32Z</dc:date>
    </item>
  </channel>
</rss>

