<?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 Text Date to SAS Date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30714#M5877</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Tom/ Art&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Both your responses are very helpful, but I am getting 2 parameters from the prompt, a month (text value from selected from a drop down menu) and year (a date value formatted as a year) Now I have to concatenate these to values to get the month and year and then find the last day of the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg. &lt;/P&gt;&lt;P&gt;user selects January for the month and 2011 for the year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then I need to get 1/31/2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code I have &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let SEL_MONTH=February;&lt;BR /&gt;%let SEL_YEAR=01Jan2011;&lt;BR /&gt;data _null_;&lt;BR /&gt;length fmonth $15. dmonth $15.;&lt;BR /&gt; call symput('dyear',put("&amp;amp;sel_Year"d,year4.)); &lt;BR /&gt; dmonth="'"||"01"||substr("&amp;amp;sel_Month",1,3)||"&amp;amp;dyear"||"'";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('dmonth',(dmonth));&lt;/P&gt;&lt;P&gt; ddate=input('&amp;amp;dmonth', date9.);&lt;BR /&gt; format ddate date9.;&lt;BR /&gt; call symput('ddate',ddate);&lt;/P&gt;&lt;P&gt; lastDay=intnx('Month' ,"&amp;amp;dmonth"d,0,E);&lt;BR /&gt; call symput('lastday',"'"||put(lastday,mmddyyS10.)||"'");&lt;BR /&gt;run;&lt;BR /&gt;%put &amp;amp;sel_Month;&lt;BR /&gt;%put &amp;amp;dYear;&lt;BR /&gt;%put &amp;amp;lastday;&lt;BR /&gt;%put &amp;amp;ddate;&lt;BR /&gt;%put &amp;amp;dmonth;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure what I am doing wrong, but I am not getting the last day of the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Oct 2011 18:15:08 GMT</pubDate>
    <dc:creator>sks</dc:creator>
    <dc:date>2011-10-18T18:15:08Z</dc:date>
    <item>
      <title>Text Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30711#M5874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have a text date in the format '10Jan2011', I need to find the last day of the month, for the given date. How do I convert the text date into sas date and then find the last day of the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You for all your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 17:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30711#M5874</guid>
      <dc:creator>sks</dc:creator>
      <dc:date>2011-10-18T17:29:05Z</dc:date>
    </item>
    <item>
      <title>Text Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30712#M5875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you are looking for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat date $9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input date;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;10Jan2011&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have (rename=(date=textdate));&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date last_day_of_month date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; date=input(textdate,date9.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; last_day_of_month=intnx('month',date,0,"E");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 17:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30712#M5875</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-10-18T17:37:17Z</dc:date>
    </item>
    <item>
      <title>Text Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30713#M5876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have it as a macro variable then you can use it as date literal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let textdate=10JAN2011;&lt;/P&gt;&lt;P&gt;%let endmonth = %sysfunc(intnx(month,"&amp;amp;textdate"d,0,E),date9.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;textdate &amp;amp;endmonth;&lt;/P&gt;&lt;P&gt;10JAN2011 31JAN2011&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 17:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30713#M5876</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-10-18T17:58:47Z</dc:date>
    </item>
    <item>
      <title>Text Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30714#M5877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Tom/ Art&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Both your responses are very helpful, but I am getting 2 parameters from the prompt, a month (text value from selected from a drop down menu) and year (a date value formatted as a year) Now I have to concatenate these to values to get the month and year and then find the last day of the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg. &lt;/P&gt;&lt;P&gt;user selects January for the month and 2011 for the year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then I need to get 1/31/2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code I have &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let SEL_MONTH=February;&lt;BR /&gt;%let SEL_YEAR=01Jan2011;&lt;BR /&gt;data _null_;&lt;BR /&gt;length fmonth $15. dmonth $15.;&lt;BR /&gt; call symput('dyear',put("&amp;amp;sel_Year"d,year4.)); &lt;BR /&gt; dmonth="'"||"01"||substr("&amp;amp;sel_Month",1,3)||"&amp;amp;dyear"||"'";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('dmonth',(dmonth));&lt;/P&gt;&lt;P&gt; ddate=input('&amp;amp;dmonth', date9.);&lt;BR /&gt; format ddate date9.;&lt;BR /&gt; call symput('ddate',ddate);&lt;/P&gt;&lt;P&gt; lastDay=intnx('Month' ,"&amp;amp;dmonth"d,0,E);&lt;BR /&gt; call symput('lastday',"'"||put(lastday,mmddyyS10.)||"'");&lt;BR /&gt;run;&lt;BR /&gt;%put &amp;amp;sel_Month;&lt;BR /&gt;%put &amp;amp;dYear;&lt;BR /&gt;%put &amp;amp;lastday;&lt;BR /&gt;%put &amp;amp;ddate;&lt;BR /&gt;%put &amp;amp;dmonth;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure what I am doing wrong, but I am not getting the last day of the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 18:15:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30714#M5877</guid>
      <dc:creator>sks</dc:creator>
      <dc:date>2011-10-18T18:15:08Z</dc:date>
    </item>
    <item>
      <title>Text Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30715#M5878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your inputs are macro variables, and you only need another macro variable showing the end of the month, why not use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let SEL_MONTH=February;&lt;/P&gt;&lt;P&gt;%let SEL_YEAR=01Jan2011;&lt;/P&gt;&lt;P&gt;%let endmonth = 01%sysfunc(substr(&amp;amp;sel_month,1,3))%sysfunc(substr(&amp;amp;sel_year,6,4));&lt;/P&gt;&lt;P&gt;%let endmonth = %sysfunc(intnx(month,"&amp;amp;endmonth"d,0,E),date9.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;endmonth;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 19:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30715#M5878</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-10-18T19:10:05Z</dc:date>
    </item>
    <item>
      <title>Text Date to SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30716#M5879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks Art, for the Macro suggestion, it is very helpful and has helped in what I have been trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2011 19:29:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-Date-to-SAS-Date/m-p/30716#M5879</guid>
      <dc:creator>sks</dc:creator>
      <dc:date>2011-10-21T19:29:40Z</dc:date>
    </item>
  </channel>
</rss>

