<?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 Combining date month and year into one column for date. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/554881#M9586</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very large data set where birthdays are separated into three columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have Brthmn brthdt and brthyr.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use the MDY function to create the variable Birthdt which would include the month,date, and year.&lt;/P&gt;&lt;P&gt;The issue is that Brthmn is in the three letter abbreviation format (ex: 'Jan'), so I cannot use MDY because it is not a numeric variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ultimately the date will need to be in the date9 format so if that could be done it would be great.. ALSO. There are some instances where the day is missing and I would need to assign a generic date to that person like date=01 for example. Any tips would be greatly appreciated.&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;</description>
    <pubDate>Mon, 29 Apr 2019 23:48:18 GMT</pubDate>
    <dc:creator>klj81</dc:creator>
    <dc:date>2019-04-29T23:48:18Z</dc:date>
    <item>
      <title>Combining date month and year into one column for date.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/554881#M9586</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very large data set where birthdays are separated into three columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have Brthmn brthdt and brthyr.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use the MDY function to create the variable Birthdt which would include the month,date, and year.&lt;/P&gt;&lt;P&gt;The issue is that Brthmn is in the three letter abbreviation format (ex: 'Jan'), so I cannot use MDY because it is not a numeric variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ultimately the date will need to be in the date9 format so if that could be done it would be great.. ALSO. There are some instances where the day is missing and I would need to assign a generic date to that person like date=01 for example. Any tips would be greatly appreciated.&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;</description>
      <pubDate>Mon, 29 Apr 2019 23:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/554881#M9586</guid>
      <dc:creator>klj81</dc:creator>
      <dc:date>2019-04-29T23:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Combining date month and year into one column for date.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/554884#M9587</link>
      <description>&lt;P&gt;Date = input(coalesce(day, 1)||mon||year, date9.);&lt;BR /&gt;Format date date9.;&lt;BR /&gt;&lt;BR /&gt;Untested code due to lack of sample data.&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/258707"&gt;@klj81&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a very large data set where birthdays are separated into three columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have Brthmn brthdt and brthyr.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to use the MDY function to create the variable Birthdt which would include the month,date, and year.&lt;/P&gt;
&lt;P&gt;The issue is that Brthmn is in the three letter abbreviation format (ex: 'Jan'), so I cannot use MDY because it is not a numeric variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ultimately the date will need to be in the date9 format so if that could be done it would be great.. ALSO. There are some instances where the day is missing and I would need to assign a generic date to that person like date=01 for example. Any tips would be greatly appreciated.&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;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 00:49:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/554884#M9587</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-30T00:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Combining date month and year into one column for date.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890291#M39593</link>
      <description>&lt;P&gt;I have the same question. I have mentioned a sample data, named have. I would like to combine&amp;nbsp;StartDay, StartMonth, and StartYear to create a StartDate column.&lt;/P&gt;
&lt;P&gt;Please help&lt;/P&gt;
&lt;LI-SPOILER&gt;data have;&lt;BR /&gt;input ID $ StartDay StartMonth StartYear ;&lt;BR /&gt;cards;&lt;BR /&gt;001 10 9 2022 &lt;BR /&gt;002 4 3 2022&lt;BR /&gt;003 2 7 2022&lt;BR /&gt;004 7 17 2022 &lt;BR /&gt;005 10 24 2022&lt;BR /&gt;006 11 14 2022&lt;BR /&gt;;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Mon, 21 Aug 2023 20:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890291#M39593</guid>
      <dc:creator>Barkat</dc:creator>
      <dc:date>2023-08-21T20:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Combining date month and year into one column for date.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890295#M39594</link>
      <description>&lt;P&gt;If you have numeric values for month, day and year then use the MDY function. Then assign a format that humans can read in your preferred style.&lt;/P&gt;
&lt;PRE&gt;data have;
   input ID $ StartDay StartMonth StartYear ;
   startdate = mdy(startmonth, startday,startyear);
   format startdate date9.;
cards;
001 10 9 2022
002 4 3 2022
003 2 7 2022
004 7 17 2022
005 10 24 2022
006 11 14 2022
;&lt;/PRE&gt;
&lt;P&gt;BTW, it is preferred on this forum that you start a new question and reference an old one like this. The originator of a question has the ability to mark answers accepted. Also you never know when your question may become considerably more complex or different from the thread you add to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 20:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890295#M39594</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-21T20:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Combining date month and year into one column for date.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890296#M39595</link>
      <description>&lt;P&gt;I used the following code. However the StartDate appears only in first three rows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;
   startdate = mdy(startmonth, startday,startyear);
   format startdate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks so much!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 20:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890296#M39595</guid>
      <dc:creator>Barkat</dc:creator>
      <dc:date>2023-08-21T20:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Combining date month and year into one column for date.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890297#M39596</link>
      <description>Thanks for your advise. I will start a new question then.</description>
      <pubDate>Mon, 21 Aug 2023 20:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890297#M39596</guid>
      <dc:creator>Barkat</dc:creator>
      <dc:date>2023-08-21T20:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Combining date month and year into one column for date.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890302#M39597</link>
      <description>It worked. I had a mistake in my code for sample data (switch StartDay and StartMontn). That is why I got missing StartDate. Thanks so much!</description>
      <pubDate>Mon, 21 Aug 2023 20:57:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-date-month-and-year-into-one-column-for-date/m-p/890302#M39597</guid>
      <dc:creator>Barkat</dc:creator>
      <dc:date>2023-08-21T20:57:23Z</dc:date>
    </item>
  </channel>
</rss>

