<?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: Pulling Month and Day Out of a Var Then Transforming into a Date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149643#M262371</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;compress(old_date,'_'), then concat year to old date, followed by formatting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Sep 2014 21:05:54 GMT</pubDate>
    <dc:creator>venka</dc:creator>
    <dc:date>2014-09-17T21:05:54Z</dc:date>
    <item>
      <title>Pulling Month and Day Out of a Var Then Transforming into a Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149642#M262370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. I am trying to pull the date out of a variable which contains underscores. The var contains just month and day so I need to add the current year and turn the var into a date (numeric) var.&amp;nbsp; I tried to use scan and substr but since the month and day are not always in the same place (one digit day or two digit day) I could not get it to work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I start with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 91px; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;" width="91"&gt;&lt;STRONG&gt;Old_Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_12_Jul&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_4_Jul&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_1_Aug&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_5_Jan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_12_Dec&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_1_Nov&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_10_Jul&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_28_Jul&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_5_Dec&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_7_Nov&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_9_Jul&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;_28_Jul&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the desired output: &lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 126px; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;" width="126"&gt;&lt;STRONG&gt;New_date&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;07/12/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;07/04/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;08/01/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;01/05/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;12/12/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;11/01/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;07/10/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;07/28/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;12/05/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;11/07/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;07/09/14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="color: #575757; text-align: left; padding: 0px; font-family: arial, helvetica, sans-serif; background-color: transparent;"&gt;07/28/14&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 20:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149642#M262370</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2014-09-17T20:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling Month and Day Out of a Var Then Transforming into a Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149643#M262371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;compress(old_date,'_'), then concat year to old date, followed by formatting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 21:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149643#M262371</guid>
      <dc:creator>venka</dc:creator>
      <dc:date>2014-09-17T21:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling Month and Day Out of a Var Then Transforming into a Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149644#M262372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Date=input(compress(old_date, '_')||'2014', date9.);&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 21:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149644#M262372</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-09-17T21:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling Month and Day Out of a Var Then Transforming into a Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149645#M262373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thanks!.&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Your code didn't work I got back the error message:&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Invalid argument to function INPUT.&amp;nbsp; Not sure why. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 21:17:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149645#M262373</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2014-09-17T21:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling Month and Day Out of a Var Then Transforming into a Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149646#M262374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;day=compress(old_date,,'kd');&lt;/P&gt;&lt;P&gt;month=compress(old_date,,'ka');&lt;/P&gt;&lt;P&gt;new_date=input(cats(day,month,'2014'),date9.);&lt;/P&gt;&lt;P&gt;format new_date mmddyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 21:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pulling-Month-and-Day-Out-of-a-Var-Then-Transforming-into-a-Date/m-p/149646#M262374</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-09-17T21:21:16Z</dc:date>
    </item>
  </channel>
</rss>

